|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Represents a line segment in 3D space. More...
#include <point.H>
Public Member Functions | |
| Segment3D ()=default | |
| Default constructor. | |
| Segment3D (const Point3D &src, const Point3D &tgt) | |
| Constructs a 3D segment from two endpoints. | |
| const Point3D & | get_src () const noexcept |
| Gets the source point of the segment. | |
| const Point3D & | get_tgt () const noexcept |
| Gets the target point of the segment. | |
| const Point3D & | get_src_point () const noexcept |
| Gets the source point of the segment (alias for get_src). | |
| const Point3D & | get_tgt_point () const noexcept |
| Gets the target point of the segment (alias for get_tgt). | |
| Point3D | direction () const |
| Calculates the direction vector of the segment. | |
| Geom_Number | length_squared () const |
| Calculates the squared length of the segment. | |
| Geom_Number | length () const |
| Calculates the length of the segment. | |
| Point3D | at (const Geom_Number &t) const |
| Evaluates a point on the segment via linear interpolation. | |
| Point3D | midpoint () const |
| Calculates the midpoint of the segment. | |
| bool | operator== (const Segment3D &s) const |
| Checks for equality between two segments. | |
| bool | operator!= (const Segment3D &s) const |
| Checks for inequality. | |
| bool | contains (const Point3D &p) const |
| Checks if a point lies on the segment. | |
| Geom_Number | distance_to (const Point3D &p) const |
| Calculates the shortest distance from a point to this segment. | |
Private Attributes | |
| Point3D | src_ |
| Point3D | tgt_ |
|
default |
Default constructor.
Initializes a zero-length segment at the origin.
|
inline |
Evaluates a point on the segment via linear interpolation.
| t | The interpolation parameter, clamped to [0, 1]. t=0 returns src, t=1 returns tgt. |
Point3D at parameter t. Definition at line 3266 of file point.H.
Referenced by distance_to(), midpoint(), and TEST_F().
Checks if a point lies on the segment.
| p | The point to check. |
true if the point is collinear and between the endpoints. Definition at line 3309 of file point.H.
References Aleph::Point3D::cross(), direction(), Aleph::Point3D::dot(), src_, and w.
Referenced by TEST_F().
|
inline |
Calculates the direction vector of the segment.
Point3D representing the vector from source to target. Definition at line 3241 of file point.H.
Referenced by contains(), and distance_to().
|
inline |
Calculates the shortest distance from a point to this segment.
| p | The point. |
Definition at line 3331 of file point.H.
References at(), direction(), Aleph::Point3D::distance_to(), Aleph::divide_and_conquer_partition_dp(), Aleph::Point3D::dot(), and src_.
Referenced by TEST_F().
Gets the source point of the segment.
Definition at line 3229 of file point.H.
References src_.
Referenced by Aleph::operator<<(), and TEST_F().
Gets the target point of the segment.
Definition at line 3231 of file point.H.
References tgt_.
Referenced by Aleph::operator<<(), and TEST_F().
|
inline |
|
inline |
|
inline |
Checks for inequality.
| s | The other segment. |
true if source or target points are different. Definition at line 3299 of file point.H.
References Aleph::divide_and_conquer_partition_dp().
Checks for equality between two segments.
| s | The other segment. |
true if segments are equal, false otherwise. Definition at line 3288 of file point.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), src_, and tgt_.
|
private |
Definition at line 3215 of file point.H.
Referenced by at(), contains(), direction(), distance_to(), get_src(), get_src_point(), length(), length_squared(), and operator==().
|
private |
Definition at line 3215 of file point.H.
Referenced by at(), direction(), get_tgt(), get_tgt_point(), length(), length_squared(), and operator==().