#include <hikogui/graphic_path/bezier_curve.hpp>
|
| enum class | Type : uint8_t { None
, Linear
, Quadratic
, Cubic
} |
|
|
| bezier_curve (bezier_curve const &other) noexcept=default |
|
| bezier_curve (bezier_curve &&other) noexcept=default |
|
bezier_curve & | operator= (bezier_curve const &other) noexcept=default |
|
bezier_curve & | operator= (bezier_curve &&other) noexcept=default |
| | bezier_curve (point2 const P1, point2 const P2) noexcept |
| | bezier_curve (point2 const P1, point2 const C1, point2 const P2) noexcept |
| | bezier_curve (point2 const P1, point2 const C1, point2 const C2, point2 const P2) noexcept |
| | bezier_curve (Type const type, point2 const P1, point2 const C1, point2 const C2, point2 const P2) noexcept |
| point2 | pointAt (float const t) const noexcept |
| constexpr vector2 | tangentAt (float const t) const noexcept |
| lean_vector< float > | solveXByY (float const y) const noexcept |
|
hi_force_inline lean_vector< float > | solveTForNormalsIntersectingPoint (point2 P) const noexcept |
| sdf_distance_result | sdf_distance (point2 P) const noexcept |
| | Find the distance from the point to the curve.
|
| std::pair< bezier_curve, bezier_curve > | cubicSplit (float const t) const noexcept |
| std::pair< bezier_curve, bezier_curve > | quadraticSplit (float const t) const noexcept |
| std::pair< bezier_curve, bezier_curve > | linearSplit (float const t) const noexcept |
| std::pair< bezier_curve, bezier_curve > | split (float const t) const noexcept |
| void | subdivideUntilFlat_impl (std::vector< bezier_curve > &r, float const minimumFlatness) const noexcept |
| std::vector< bezier_curve > | subdivideUntilFlat (float const tolerance) const noexcept |
| float | flatness () const noexcept |
| bezier_curve | toParallelLine (float const offset) const noexcept |
|
|
Type | type |
| point2 | P1 |
| | First point.
|
| point2 | C1 |
| | Control point.
|
| point2 | C2 |
| | Control point.
|
| point2 | P2 |
| | Last point.
|
|
|
bool | operator== (bezier_curve const &lhs, bezier_curve const &rhs) noexcept |
|
bezier_curve | operator* (transformer2 auto const &lhs, bezier_curve const &rhs) noexcept |
| bezier_curve | operator~ (bezier_curve const &rhs) noexcept |
Bezier Curve A linear, quadratic or cubic bezier curve.
◆ bezier_curve() [1/4]
| hi::v1::bezier_curve::bezier_curve |
( |
point2 const | P1, |
|
|
point2 const | P2 ) |
|
inlinenoexcept |
Construct a linear bezier-curve.
◆ bezier_curve() [2/4]
| hi::v1::bezier_curve::bezier_curve |
( |
point2 const | P1, |
|
|
point2 const | C1, |
|
|
point2 const | P2 ) |
|
inlinenoexcept |
Construct a quadratic bezier-curve.
◆ bezier_curve() [3/4]
| hi::v1::bezier_curve::bezier_curve |
( |
point2 const | P1, |
|
|
point2 const | C1, |
|
|
point2 const | C2, |
|
|
point2 const | P2 ) |
|
inlinenoexcept |
Construct a cubic bezier-curve.
◆ bezier_curve() [4/4]
| hi::v1::bezier_curve::bezier_curve |
( |
Type const | type, |
|
|
point2 const | P1, |
|
|
point2 const | C1, |
|
|
point2 const | C2, |
|
|
point2 const | P2 ) |
|
inlinenoexcept |
Construct a bezier-curve of any type.
◆ cubicSplit()
| std::pair< bezier_curve, bezier_curve > hi::v1::bezier_curve::cubicSplit |
( |
float const | t | ) |
const |
|
inlinenodiscardnoexcept |
Split a cubic bezier-curve into two cubic bezier-curve.
- Parameters
-
| t | a relative distance between 0.0 (point P1) and 1.0 (point P2) where to split the curve. |
- Returns
- two cubic bezier-curves.
◆ flatness()
| float hi::v1::bezier_curve::flatness |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Return the flatness of a curve.
- Returns
- 1.0 when completely flat, < 1.0 when curved.
◆ linearSplit()
| std::pair< bezier_curve, bezier_curve > hi::v1::bezier_curve::linearSplit |
( |
float const | t | ) |
const |
|
inlinenodiscardnoexcept |
Split a linear bezier-curve into two linear bezier-curve.
- Parameters
-
| t | a relative distance between 0.0 (point P1) and 1.0 (point P2) where to split the curve. |
- Returns
- two linear bezier-curves.
◆ pointAt()
| point2 hi::v1::bezier_curve::pointAt |
( |
float const | t | ) |
const |
|
inlinenodiscardnoexcept |
Return a point on the bezier-curve. Values of t beyond 0.0 and 1.0 will find a point extrapolated beyond the bezier segment.
- Parameters
-
| t | a relative distance between 0.0 (point P1) and 1.0 (point P2). |
- Returns
- the coordinates of the point on the curve.
◆ quadraticSplit()
| std::pair< bezier_curve, bezier_curve > hi::v1::bezier_curve::quadraticSplit |
( |
float const | t | ) |
const |
|
inlinenodiscardnoexcept |
Split a quadratic bezier-curve into two quadratic bezier-curve.
- Parameters
-
| t | a relative distance between 0.0 (point P1) and 1.0 (point P2) where to split the curve. |
- Returns
- two quadratic bezier-curves.
◆ sdf_distance()
Find the distance from the point to the curve.
If the distances are equal between two curves, take the one with a maximum orthognality. If the orthogonality >= then the point is inside that edge.
- Parameters
-
| P | The point from which to calculate the distance to this curve. |
- Returns
- squared distance from curve, orthogonality.
◆ solveXByY()
| lean_vector< float > hi::v1::bezier_curve::solveXByY |
( |
float const | y | ) |
const |
|
inlinenodiscardnoexcept |
Return the x values where the curve crosses the y-axis.
- Parameters
-
- Returns
- 0 to 3, or infinite number of x values.
◆ split()
| std::pair< bezier_curve, bezier_curve > hi::v1::bezier_curve::split |
( |
float const | t | ) |
const |
|
inlinenodiscardnoexcept |
Split a bezier-curve into two bezier-curve of the same type.
- Parameters
-
| t | a relative distance between 0.0 (point P1) and 1.0 (point P2) where to split the curve. |
- Returns
- two bezier-curves.
◆ subdivideUntilFlat()
| std::vector< bezier_curve > hi::v1::bezier_curve::subdivideUntilFlat |
( |
float const | tolerance | ) |
const |
|
inlinenodiscardnoexcept |
Subdivide a bezier-curve until each are flat enough.
- Parameters
-
| tolerance | maximum amount of curviness. |
- Returns
- resulting list of curve segments.
◆ subdivideUntilFlat_impl()
| void hi::v1::bezier_curve::subdivideUntilFlat_impl |
( |
std::vector< bezier_curve > & | r, |
|
|
float const | minimumFlatness ) const |
|
inlinenoexcept |
Subdivide a bezier-curve until each are flat enough.
- Parameters
-
| r | resulting list of linear segments. |
| minimumFlatness | minimum amount of flatness of the resulting curve segments. |
◆ tangentAt()
| vector2 hi::v1::bezier_curve::tangentAt |
( |
float const | t | ) |
const |
|
inlinenodiscardconstexprnoexcept |
Return a tangent on the bezier-curve. Values of t beyond 0.0 and 1.0 will find a point extrapolated beyond the bezier segment.
- Parameters
-
| t | a relative distance between 0.0 (point P1) and 1.0 (point P2). |
- Returns
- the tangent-vector at point t on the curve
◆ toParallelLine()
| bezier_curve hi::v1::bezier_curve::toParallelLine |
( |
float const | offset | ) |
const |
|
inlinenodiscardnoexcept |
Return a line-segment from a curve at a certain distance.
- Parameters
-
| offset | positive means the parallel line will be on the starboard of the curve. |
- Returns
- line segment offset from the curve.
◆ operator~
| bezier_curve operator~ |
( |
bezier_curve const & | rhs | ) |
|
|
friend |
Reverse direction of a curve.
◆ C1
| point2 hi::v1::bezier_curve::C1 |
◆ C2
| point2 hi::v1::bezier_curve::C2 |
◆ P1
| point2 hi::v1::bezier_curve::P1 |
◆ P2
| point2 hi::v1::bezier_curve::P2 |
The documentation for this struct was generated from the following file: