Visual Computing Library
|
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConcept
, which must provide the DIM
constant and the []
operator for accessing the point coordinates.
More...
#include <vclib/space/core/segment.h>
Public Types | |
using | PointType = PointT |
The type of point used to represent the endpoint points of the segment. | |
using | ScalarType = PointT::ScalarType |
The scalar type of the endpoint points. | |
Public Member Functions | |
Segment () | |
Default constructor. Creates a segment with endpoints at the origin. | |
Segment (const PointT &p0, const PointT &p1) | |
Creates a segment with the given endpoints. | |
PointT & | p0 () |
Returns the first endpoint of the segment. | |
const PointT & | p0 () const |
Returns the first endpoint of the segment. | |
PointT & | p1 () |
Returns the second endpoint of the segment. | |
const PointT & | p1 () const |
Returns the second endpoint of the segment. | |
PointT | midPoint () const |
PointT | direction () const |
PointT | normalizedDirection () const |
ScalarType | length () const |
ScalarType | squaredLength () const |
void | flip () |
bool | operator== (const Segment< PointT > &s) const =default |
bool | operator!= (const Segment< PointT > &s) const =default |
Segment< PointT > | operator+ (const Segment< PointT > &s) const |
Segment< PointT > | operator- (const Segment< PointT > &s) const |
Segment< PointT > | operator* (const ScalarType &s) const |
Segment< PointT > | operator/ (const ScalarType &s) const |
Segment< PointT > & | operator+= (const Segment< PointT > &s) const |
Segment< PointT > & | operator-= (const Segment< PointT > &s) const |
Segment< PointT > & | operator*= (const ScalarType &s) const |
Segment< PointT > & | operator/= (const ScalarType &s) const |
Static Public Attributes | |
static const uint | DIM = PointT::DIM |
The dimensionality of the segment. | |
Private Attributes | |
PointT | mPoint0 |
PointT | mPoint1 |
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConcept
, which must provide the DIM
constant and the []
operator for accessing the point coordinates.
PointT | The type of the two endpoint points of the segment. |
|
inline |
Creates a segment with the given endpoints.
[in] | p0 | The first endpoint of the segment. |
[in] | p1 | The second endpoint of the segment. |
|
inline |
Returns the first endpoint of the segment.
|
inline |
Returns the first endpoint of the segment.
|
inline |
Returns the second endpoint of the segment.
|
inline |
Returns the second endpoint of the segment.