Easy3D 2.5.3
GenericSegment< DIM, FT > Class Template Reference

A generic segmentation representation, which supports both 2D and 3D line segments. More...

#include <easy3d/core/segment.h>

Public Types

typedef Vec< DIM, FT > Point
 
typedef Vec< DIM, FT > Vector
 
typedef GenericLine< DIM, FT > Line
 
typedef GenericSegment< DIM, FT > thisclass
 

Public Member Functions

 GenericSegment (const Point &s, const Point &t)
 Constructs a line segments from its two end points s and t.
 
const Pointsource () const
 Returns the source end point of this line segment.
 
const Pointtarget () 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. The return the value is the min of the following: More...
 

Detailed Description

template<int DIM, typename FT>
class easy3d::GenericSegment< DIM, FT >

A generic segmentation representation, which supports both 2D and 3D line segments.

Member Function Documentation

◆ squared_distance()

FT squared_distance ( const Point p) const
inline

Returns the squared distance of a point p to this 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;

The documentation for this class was generated from the following file: