18 return p0 + t * (p1 - p0);
22 return (1 - t) * (1 - t) * p0 +
23 2 * (1 - t) * t * p1 +
31 return 2 * (1 - t) * (p1 - p0) +
40 return (1 - t) * (1 - t) * (1 - t) * p0 +
41 3 * (1 - t) * (1 - t) * t * p1 +
42 3 * (1 - t) * t * t * p2 +
51 return -3 * p0 * (1 - t) * (1 - t) +
52 p1 * (3 * (1 - t) * (1 - t) - 6 * (1 - t) * t) +
53 p2 * (6 * (1 - t) * t - 3 * t * t) +
65 std::vector<Point>&
points)
const {
105 std::vector<Point>&
points)
const {
107 points.emplace_back(point);
116 for (
size_t i = 1; i < line_count; i += 1) {
117 proc(
Solve(i / line_count));
129 return (
p1 -
cp).Normalize();
132 return (
p1 -
p2).Normalize();
139 return (
p2 -
cp).Normalize();
142 return (
p2 -
p1).Normalize();
163 std::vector<Point>&
points)
const {
177 auto scale = (t1 - t0) * (1.0 / 3.0);
186 for (
size_t i = 1; i < line_count; i++) {
187 proc(
Solve(i / line_count));
193 return (
a > (
b - epsilon)) && (
a < (
b + epsilon));
205 const Scalar a = 3.0 * (-p1 + 3.0 * p2 - 3.0 * p3 + p4);
206 const Scalar b = 6.0 * (p1 - 2.0 * p2 + p3);
207 const Scalar c = 3.0 * (p2 - p1);
218 if (t >= 0.0 && t <= 1.0) {
219 values.emplace_back(t);
224 Scalar b2Minus4AC = (
b *
b) - (4.0 *
a * c);
226 if (b2Minus4AC < 0.0) {
230 Scalar rootB2Minus4AC = ::sqrt(b2Minus4AC);
238 Scalar q = (
b < 0) ? -(
b - rootB2Minus4AC) / 2 : -(
b + rootB2Minus4AC) / 2;
242 if (t >= 0.0 && t <= 1.0) {
243 values.emplace_back(t);
249 if (t >= 0.0 && t <= 1.0) {
250 values.emplace_back(t);
259 std::vector<Scalar> values;
266 for (
const auto&
value : values) {
static const int points[]
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static void CubicPathBoundingPopulateValues(std::vector< Scalar > &values, Scalar p1, Scalar p2, Scalar p3, Scalar p4)
static bool NearZero(Scalar a)
static Scalar LinearSolve(Scalar t, Scalar p0, Scalar p1)
static Scalar CubicSolve(Scalar t, Scalar p0, Scalar p1, Scalar p2, Scalar p3)
static Scalar CubicSolveDerivative(Scalar t, Scalar p0, Scalar p1, Scalar p2, Scalar p3)
static Scalar QuadraticSolve(Scalar t, Scalar p0, Scalar p1, Scalar p2)
static Scalar QuadraticSolveDerivative(Scalar t, Scalar p0, Scalar p1, Scalar p2)
Scalar ComputeQuadradicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2)
Scalar ComputeCubicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2, Point p3)
static bool NearEqual(Scalar a, Scalar b, Scalar epsilon)
void ToLinearPathComponents(Scalar scale, const PointProc &proc) const
void AppendPolylinePoints(Scalar scale, std::vector< Point > &points) const
std::function< void(const Point &point)> PointProc
CubicPathComponent Subsegment(Scalar t0, Scalar t1) const
Point Solve(Scalar time) const
std::optional< Vector2 > GetStartDirection() const
std::vector< Point > Extrema() const
std::optional< Vector2 > GetEndDirection() const
Point SolveDerivative(Scalar time) const
std::optional< Vector2 > GetEndDirection() const
std::optional< Vector2 > GetStartDirection() const
std::vector< Point > Extrema() const
Point Solve(Scalar time) const
void AppendPolylinePoints(std::vector< Point > &points) const
std::optional< Vector2 > operator()(const LinearPathComponent *component)
std::optional< Vector2 > operator()(const LinearPathComponent *component)
std::optional< Vector2 > GetEndDirection() const
void AppendPolylinePoints(Scalar scale_factor, std::vector< Point > &points) const
std::function< void(const Point &point)> PointProc
std::vector< Point > Extrema() const
Point SolveDerivative(Scalar time) const
std::optional< Vector2 > GetStartDirection() const
void ToLinearPathComponents(Scalar scale_factor, const PointProc &proc) const
Point Solve(Scalar time) const
constexpr TPoint Normalize() const