|
| Segment3D ()=default |
| Creates a new line segment whose endpoints are uninitialised.
|
|
constexpr | Segment3D (const Segment3D &)=default |
| Creates a new copy of the given line segment.
|
|
constexpr | Segment3D (const Vector3D< Real > &u, const Vector3D< Real > &v) |
| Creates a new line segment with the given endpoints.
|
|
Segment3D & | operator= (const Segment3D &)=default |
| Sets this to be a copy of the given line segment.
|
|
constexpr bool | operator== (const Segment3D &other) const |
| Determines if this and the given line segment have the same endpoints, in the same order.
|
|
constexpr Real | length () const |
| Returns the length of this line segment.
|
|
constexpr Vector3D< Real > | point (Real lambda) const |
| Returns the point on this line segment represented by the given real number 𝜆.
|
|
constexpr Segment3D | operator+ (const Vector3D< Real > &translation) const |
| Returns the translation of this line segment by the given vector.
|
|
Segment3D & | operator+= (const Vector3D< Real > &translation) |
| Translates this line segment by the given vector.
|
|
constexpr Segment3D | operator- (const Vector3D< Real > &translation) const |
| Returns the translation of this line segment by the negative of the given vector.
|
|
Segment3D & | operator-= (const Vector3D< Real > &translation) |
| Translates this line segment by the negative of the given vector.
|
|
constexpr Vector3D< Real > | midpoint () const |
| Returns the midpoint of this line segment.
|
|
Real | closest (const Vector3D< Real > &p) const |
| Computes the closest point on this line segment to the given point.
|
|
template<typename Real = double>
struct regina::Segment3D< Real >
Represents a line segment in 3-dimensional space, defined by its two endpoints u and v.
The points on this line segment are precisely those points of the form 𝜆v + (1-𝜆)u
, where 𝜆 is any real number between 0 and 1 inclusive.
Degenerate segments (whose two endpoints are the same) are explicitly supported by this class.
See Regina's notes on 3-D geometry for important information, including the inexact floating-point nature of the Vector3D class, and the right-handedness of Regina's coordinate system.
These objects are small enough to pass by value and swap with std::swap(), with no need for any specialised move operations or swap functions.
- Python
- The template parameter Real is
double
.
- Template Parameters
-
Real | the floating-point type to use for all storage and computation. |
template<typename Real = double>
Computes the closest point on this line segment to the given point.
This routine does respect the limits defined by the two endpoints of this line segment. That is, the resulting closest point will always lie between the two endpoints of this segment inclusive.
This routine does behave correctly if this segment is degenerate (i.e., its two endpoints are the same); however, the real number that is returned could be anywhere between 0 and 1 inclusive.
- Parameters
-
p | the point whose proximity we are interested in. |
- Returns
- a real number 𝜆 between 0 and 1 inclusive, where the closest point to p on this segment is the point
𝜆v + (1-𝜆)u
; in other words, point(𝜆)
.
template<typename Real = double>
Returns the point on this line segment represented by the given real number 𝜆.
As outlined in the class notes, this line segment contains all points of the form 𝜆v + (1-𝜆)u
, where 𝜆 is any real number between 0 and 1 inclusive. This routine returns the exact point corresponding to the given argument 𝜆. In particular point(0)
will return the first endpoint u, and point(1)
will return the second endpoint v.
- Parameters
-
lambda | the real number 𝜆 as described above. Typically this would be between 0 and 1 inclusive; however, there is no problem passing a value of 𝜆 outside this range (which, for non-degenerate segments, means the resulting point will be outside the bounds of this line segment). |
- Returns
- the corresponding point
𝜆v + (1-𝜆)u
.