ImFusion SDK 4.3
LineSegment Class Referencefinal

#include <ImFusion/Core/Geometry/Line.h>

Class representing a line segment, i.e. More...

+ Inheritance diagram for LineSegment:

Detailed Description

Class representing a line segment, i.e.

a finite line defined by points at either end

See also
Intersections between geometry primitives can be computed using the sets of free functions Geometry::intersection() and Geometry::intersects().

Public Member Functions

 LineSegment (const vec3 &start, const vec3 &end)
 Creates a line segment from start to end.
 
 LineSegment (const LineSegment &)=default
 
LineSegmentoperator= (const LineSegment &)=default
 
const vec3 & start () const
 Returns the start point, equivalent to LineBase::point.
 
const vec3 & end () const
 Returns the end point.
 
vec3 direction () const override
 Returns the normalized direction from start to end or NANs if those are the same point.
 
double length () const
 Returns the distance between start and end points.
 
bool isApprox (const LineSegment &) const
 Comparison using the same epsilon as Eigen::isApprox.
 
double clampLambda (double lambda) const override
 Clamps the input to [0, length()].
 
- Public Member Functions inherited from LineBase
const vec3 & point () const
 Returns a point on the line.
 
vec3 closestPoint (const vec3 &p) const
 Returns the point on the line closest to p.
 
double distanceToPoint (const vec3 &p) const
 Returns the L2 distance between p and the closest point on the line.
 
bool includesPoint (const vec3 &p) const
 Returns if the distance between p and the closest point on the line is less than epsilon.
 
std::vector< vec3 > cylinderWallIntersection (const Line &axis, double radius) const
 Computes the intersection points with the outer wall of a cylinder of infinite length, specified by radius and central axis.
 
double pointToLambda (const vec3 &p) const
 Projects p onto the (extended) line and returns the unclamped lambda.
 
vec3 lambdaToPoint (double lambda) const
 Returns point() + lambda*direction()
 

Protected Attributes

vec3 m_end
 End of the line segment.
 
- Protected Attributes inherited from LineBase
vec3 m_point
 A point on the line.
 
bool operator== (const LineSegment &) const
 Exact comparisons.
 
bool operator!= (const LineSegment &) const
 
Utils::Variant< LineSegment, vec3, std::nullptr_tshortestConnectingLine (const Line &l) const
 Shortest connections to other lines.
 
Utils::Variant< LineSegment, vec3, std::nullptr_tshortestConnectingLine (const LineSegment &l) const
 

Additional Inherited Members

- Protected Member Functions inherited from LineBase
 LineBase (const vec3 &p)
 

Constructor & Destructor Documentation

◆ LineSegment()

LineSegment ( const vec3 & start,
const vec3 & end )

Creates a line segment from start to end.

If those points are the same, the line segment will mostly behave like a very inefficient point.

Member Function Documentation

◆ direction()

vec3 direction ( ) const
overridevirtual

Returns the normalized direction from start to end or NANs if those are the same point.

Implements LineBase.

◆ shortestConnectingLine()

Utils::Variant< LineSegment, vec3, std::nullptr_t > shortestConnectingLine ( const Line & l) const

Shortest connections to other lines.

Returns the shortest connection to l as a LineSegment. If the objects intersect or overlap, a point on both lines is returned instead. Empty return indicates that either object is not well defined, i.e. contains NAN.

◆ clampLambda()

double clampLambda ( double lambda) const
overridevirtual

Clamps the input to [0, length()].

Implements LineBase.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close