#include <path_measure.hpp>
|
| | PathMeasure ()=default |
| | PathMeasure (const Path &path, float tolerance=default_tolerance) |
| | Measure path.
|
| float | length () const |
| | Total length of every contour summed. 0 for an empty path.
|
| bool | is_empty () const |
| size_t | contour_count () const |
| | Contours are the move_to-delimited subpaths, in path order.
|
| float | contour_length (size_t index) const |
| bool | contour_is_closed (size_t index) const |
| | Whether contour index was closed with close().
|
| float | contour_start (size_t index) const |
| | Distance at which contour index begins, measured from the start of the path.
|
| std::optional< PathPose > | pose_at (float distance) const |
| | Position and unit tangent at distance along the path.
|
| std::optional< Point2D > | position_at (float distance) const |
| | pose_at(distance)->position, for callers that do not need the tangent.
|
| std::optional< Point2D > | tangent_at (float distance) const |
| | pose_at(distance)->tangent, for callers that do not need the position.
|
| Path | segment (float start, float end) const |
| | The part of the path between two distances, as a new Path.
|
|
| static constexpr float | default_tolerance = 0.25f |
| | The default flattening tolerance, in path units.
|
◆ PathMeasure() [1/2]
| pulp::canvas::PathMeasure::PathMeasure |
( |
| ) |
|
|
default |
◆ PathMeasure() [2/2]
Measure path.
tolerance is clamped to a small positive minimum, so a caller passing 0 gets the finest supported flattening rather than a hang.
◆ contour_count()
| size_t pulp::canvas::PathMeasure::contour_count |
( |
| ) |
const |
|
inline |
Contours are the move_to-delimited subpaths, in path order.
A path with no length (a lone move_to, or repeated identical points) yields no contour, so every contour reported here has positive length.
◆ contour_is_closed()
| bool pulp::canvas::PathMeasure::contour_is_closed |
( |
size_t | index | ) |
const |
Whether contour index was closed with close().
◆ contour_length()
| float pulp::canvas::PathMeasure::contour_length |
( |
size_t | index | ) |
const |
◆ contour_start()
| float pulp::canvas::PathMeasure::contour_start |
( |
size_t | index | ) |
const |
Distance at which contour index begins, measured from the start of the path.
contour_start(0) is always 0.
◆ is_empty()
| bool pulp::canvas::PathMeasure::is_empty |
( |
| ) |
const |
|
inline |
◆ length()
| float pulp::canvas::PathMeasure::length |
( |
| ) |
const |
|
inline |
Total length of every contour summed. 0 for an empty path.
◆ pose_at()
| std::optional< PathPose > pulp::canvas::PathMeasure::pose_at |
( |
float | distance | ) |
const |
Position and unit tangent at distance along the path.
distance is CLAMPED to [0, length()], so an out-of-range value returns the nearest endpoint rather than nothing — a meter driven past its maximum should pin, not vanish. std::nullopt means the path has no length at all, which is the one case a caller must actually branch on.
◆ position_at()
| std::optional< Point2D > pulp::canvas::PathMeasure::position_at |
( |
float | distance | ) |
const |
pose_at(distance)->position, for callers that do not need the tangent.
◆ segment()
| Path pulp::canvas::PathMeasure::segment |
( |
float | start, |
|
|
float | end ) const |
The part of the path between two distances, as a new Path.
This is the trim behind a value arc or a reveal. Both distances are clamped to [0, length()]; if start >= end after clamping the result is an empty Path. Curves are split with de Casteljau, so the result keeps the source's curve verbs rather than degrading to line segments.
A closed contour that is trimmed is no longer closed: the result is the open run between the two distances, with no closing segment.
◆ tangent_at()
| std::optional< Point2D > pulp::canvas::PathMeasure::tangent_at |
( |
float | distance | ) |
const |
pose_at(distance)->tangent, for callers that do not need the position.
◆ default_tolerance
| float pulp::canvas::PathMeasure::default_tolerance = 0.25f |
|
staticconstexpr |
The default flattening tolerance, in path units.
The documentation for this class was generated from the following file: