|
SFCGAL 2.3.0
|
Represents a line segment in space. More...
#include <Segment.h>
Public Member Functions | |
| Segment () | |
| Default constructor creating an empty segment. | |
| Segment (const Point &point1, const Point &point2) | |
| Constructor with two points. | |
| template<typename PointType, typename = std::enable_if_t<std::is_same_v<PointType, Kernel::Point_2> || std::is_same_v<PointType, Kernel::Point_3>>> | |
| Segment (const PointType &point1, const PointType &point2) | |
| Constructor with CGAL points (2D or 3D). | |
| template<typename SegmentType, typename = std::enable_if_t< std::is_same_v<SegmentType, Kernel::Segment_2> || std::is_same_v<SegmentType, Kernel::Segment_3>>> | |
| Segment (const SegmentType &segment) | |
| Constructor with CGAL segment (2D or 3D). | |
| Segment (const Segment &other)=default | |
| Copy constructor. | |
| auto | operator= (const Segment &other) -> Segment &=default |
| Assignment operator. | |
| ~Segment ()=default | |
| Destructor. | |
| auto | source () const -> const Point & |
| Gets the first endpoint. | |
| auto | target () const -> const Point & |
| Gets the second endpoint. | |
| auto | setSource (const Point &point) -> void |
| Sets the first endpoint. | |
| auto | setTarget (const Point &point) -> void |
| Sets the second endpoint. | |
| auto | setPoints (const Point &source, const Point &target) -> void |
| Sets both endpoints at once. | |
| template<typename PointType, typename = std::enable_if_t<std::is_same_v<PointType, Kernel::Point_2> || std::is_same_v<PointType, Kernel::Point_3>>> | |
| auto | setPoints (const PointType &source, const PointType &target) -> void |
| Sets both CGAL endpoints at once. | |
| auto | clear () -> void |
| Reset the segment to empty. | |
| auto | toSegment_2 () const -> Kernel::Segment_2 |
| Converts to a CGAL::Segment_2. | |
| auto | toSegment_3 () const -> Kernel::Segment_3 |
| Converts to a CGAL::Segment_3. | |
| auto | isEmpty () const -> bool |
| Checks if the segment is empty (either endpoint is empty). | |
| auto | isDegenerate () const -> bool |
| Checks if the segment is degenerate (zero length). | |
| auto | squaredLength () const -> Kernel::FT |
| Returns the squared length of the segment. | |
| auto | length () const -> Kernel::FT |
| Returns the length of the segment. | |
| auto | is3D () const -> bool |
| Checks if the segment is in 3D space. | |
| auto | isMeasured () const -> bool |
| Checks if the segment is measured. | |
| template<typename PointType> | |
| auto | squaredDistanceToPoint (const PointType &point) const -> Kernel::FT |
| Gets the squared distance from a point to the segment. | |
| template<typename... Args> | |
| auto | distanceToPoint (Args &&...args) const -> double |
| Calculate distance from segment to a point. | |
| template<typename PointType> | |
| auto | exactInterpolationParameter (const PointType &point) const -> Kernel::FT |
| Calculates the exact parameter for a projected point on the segment. | |
| template<typename... Args> | |
| auto | interpolationParameter (Args &&...args) const -> double |
| Calculates the parameter for a projected point on the segment. | |
| auto | interpolate (double t) const -> Point |
| Gets a point on the segment at given parameter. | |
| template<typename PointType> | |
| auto | hasOn (const PointType &point, double tolerance=EPSILON) const -> bool |
| Checks if a point is on the segment (works in 2D or 3D). | |
| auto | midpoint () const -> Point |
| Returns the midpoint of the segment. | |
| auto | reverse () -> void |
| Reverses the segment direction. | |
Represents a line segment in space.
This class provides methods for working with line segments and performing calculations like distance and interpolation. Unlike LineString which inherits from Geometry, this is a lightweight primitive.
| SFCGAL::Segment::Segment | ( | ) |
Default constructor creating an empty segment.
Constructor with two points.
| point1 | The first endpoint of the segment |
| point2 | The second endpoint of the segment |
| Exception | if points have inconsistent dimensions |
|
inline |
Constructor with CGAL points (2D or 3D).
| point1 | The first endpoint of the segment |
| point2 | The second endpoint of the segment |
|
inlineexplicit |
Constructor with CGAL segment (2D or 3D).
| segment | A CGAL segment |
|
default |
Copy constructor.
| other | Segment to copy from |
|
default |
Destructor.
| auto SFCGAL::Segment::clear | ( | ) | -> void |
Reset the segment to empty.
| auto SFCGAL::Segment::distanceToPoint | ( | Args &&... | args | ) | const -> double |
Calculate distance from segment to a point.
| args | Forwarded arguments for point (supports various point types) |
| Exception | if the segment is empty |
| auto SFCGAL::Segment::exactInterpolationParameter | ( | const PointType & | point | ) | const -> Kernel::FT |
Calculates the exact parameter for a projected point on the segment.
| point | The point to project (SFCGAL::Point, CGAL::Point_2, or CGAL::Point_3) |
| Exception | if the segment is empty |
| auto SFCGAL::Segment::hasOn | ( | const PointType & | point, |
| double | tolerance = EPSILON ) const -> bool |
Checks if a point is on the segment (works in 2D or 3D).
| point | The point to check |
| tolerance | Optional tolerance value |
| Exception | if the segment is empty |
| auto SFCGAL::Segment::interpolate | ( | double | t | ) | const -> Point |
Gets a point on the segment at given parameter.
| t | Parameter value between 0.0 (source) and 1.0 (target) |
| Exception | if the segment is empty |
| auto SFCGAL::Segment::interpolationParameter | ( | Args &&... | args | ) | const -> double |
| auto SFCGAL::Segment::is3D | ( | ) | const -> bool |
Checks if the segment is in 3D space.
| auto SFCGAL::Segment::isDegenerate | ( | ) | const -> bool |
Checks if the segment is degenerate (zero length).
| auto SFCGAL::Segment::isEmpty | ( | ) | const -> bool |
Checks if the segment is empty (either endpoint is empty).
| auto SFCGAL::Segment::isMeasured | ( | ) | const -> bool |
Checks if the segment is measured.
| auto SFCGAL::Segment::length | ( | ) | const -> Kernel::FT |
Returns the length of the segment.
| auto SFCGAL::Segment::midpoint | ( | ) | const -> Point |
Returns the midpoint of the segment.
| Empty | point if the segment is empty |
| auto SFCGAL::Segment::reverse | ( | ) | -> void |
Reverses the segment direction.
| Exception | if the segment is empty |
|
inline |
| auto SFCGAL::Segment::setSource | ( | const Point & | point | ) | -> void |
| auto SFCGAL::Segment::setTarget | ( | const Point & | point | ) | -> void |
|
inline |
Gets the first endpoint.
| auto SFCGAL::Segment::squaredDistanceToPoint | ( | const PointType & | point | ) | const -> Kernel::FT |
Gets the squared distance from a point to the segment.
| point | The point (SFCGAL::Point, CGAL::Point_2, or CGAL::Point_3) |
| Exception | if the segment is empty |
| auto SFCGAL::Segment::squaredLength | ( | ) | const -> Kernel::FT |
Returns the squared length of the segment.
|
inline |
Gets the second endpoint.
| auto SFCGAL::Segment::toSegment_2 | ( | ) | const -> Kernel::Segment_2 |
Converts to a CGAL::Segment_2.
| auto SFCGAL::Segment::toSegment_3 | ( | ) | const -> Kernel::Segment_3 |
Converts to a CGAL::Segment_3.