A generic segmentation representation, which supports both 2D and 3D line segments.
More...
#include <easy3d/core/segment.h>
|
typedef Vec< DIM, FT > | Point |
| The type of the point.
|
|
typedef Vec< DIM, FT > | Vector |
| The type of the vector.
|
|
typedef GenericLine< DIM, FT > | Line |
| The type of the line.
|
|
typedef GenericSegment< DIM, FT > | thisclass |
| The type of this class.
|
|
|
| GenericSegment (const Point &s, const Point &t) |
| Constructs a line segment from its two end points s and t .
|
|
| GenericSegment ()=default |
| Default constructor.
|
|
const Point & | source () const |
| Returns the source end point of this line segment.
|
|
const Point & | target () const |
| Returns the target end point of this line segment.
|
|
void | set_source (const Point &s) |
| Sets/Changes the source end point of this line segment.
|
|
void | set_target (const Point &t) |
| Sets/Changes the target end point of this line segment.
|
|
Line | supporting_line () const |
| Returns the supporting line of this line segment.
|
|
Vector | to_vector () const |
| Returns a vector originating from source() and pointing to target().
|
|
Point | projection (const Point &p) const |
| Returns the projection of a point p on the supporting line of this segment.
|
|
bool | projected_inside (const Point &p) const |
| Tests if the projection of a point p is within the two end points of this segment.
|
|
FT | squared_distance (const Point &p) const |
| Returns the squared distance of a point p to this segment.
|
|
template<int DIM, typename FT>
class easy3d::GenericSegment< DIM, FT >
A generic segmentation representation, which supports both 2D and 3D line segments.
- Template Parameters
-
DIM | The dimension of the space (2 or 3). |
FT | The scalar type for segment coordinates. |
◆ GenericSegment()
template<int DIM, typename FT>
Constructs a line segment from its two end points s
and t
.
- Parameters
-
s | The source end point. |
t | The target end point. |
◆ projected_inside()
template<int DIM, typename FT>
bool projected_inside |
( |
const Point & | p | ) |
const |
|
inline |
Tests if the projection of a point p
is within the two end points of this segment.
- Parameters
-
- Returns
true
if the projection is within the segment, false
otherwise.
◆ projection()
template<int DIM, typename FT>
Returns the projection of a point p
on the supporting line of this segment.
- Parameters
-
- Returns
- The projected point on the supporting line.
◆ set_source()
template<int DIM, typename FT>
void set_source |
( |
const Point & | s | ) |
|
|
inline |
Sets/Changes the source end point of this line segment.
- Parameters
-
s | The new source end point. |
◆ set_target()
template<int DIM, typename FT>
void set_target |
( |
const Point & | t | ) |
|
|
inline |
Sets/Changes the target end point of this line segment.
- Parameters
-
t | The new target end point. |
◆ source()
template<int DIM, typename FT>
const Point & source |
( |
| ) |
const |
|
inline |
Returns the source end point of this line segment.
- Returns
- The source end point.
◆ squared_distance()
template<int DIM, typename FT>
FT squared_distance |
( |
const Point & | p | ) |
const |
|
inline |
Returns the squared distance of a point p
to this segment.
- Parameters
-
p | The point to compute the distance to. |
- Returns
- The squared distance to the segment. The return the value is the min of the following:
- the squared distance between
p
and the supporting_line() of this segment;
- the squared distance between
p
and the source() of this segment;
- the squared distance between
p
and the target() of this segment.
◆ supporting_line()
template<int DIM, typename FT>
Line supporting_line |
( |
| ) |
const |
|
inline |
Returns the supporting line of this line segment.
- Returns
- The supporting line.
◆ target()
template<int DIM, typename FT>
const Point & target |
( |
| ) |
const |
|
inline |
Returns the target end point of this line segment.
- Returns
- The target end point.
◆ to_vector()
template<int DIM, typename FT>
Returns a vector originating from source() and pointing to target().
- Returns
- The vector from source to target.
The documentation for this class was generated from the following file: