ImFusion SDK 4.3
LineBase Class Referenceabstract

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

Common interface of Line and LineSegment. More...

+ Inheritance diagram for LineBase:

Detailed Description

Common interface of Line and LineSegment.

Unless stated otherwise, all operations that involve comparisons use the same tolerance epsilon as vec3::isApprox (which is 1e-12).

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

Public Member Functions

virtual vec3 direction () const =0
 Returns the normalized direction vector.
 
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.
 

Protected Member Functions

 LineBase (const vec3 &p)
 

Protected Attributes

vec3 m_point
 A point on the line.
 

Point projections

Any point p can be expressed as p = point() + lambda*direction() + offset, where offset is perpendicular to the line. These functions convert to and from lambda. The offset vector can be found as p-unproject(project(p)). Note that for LineSegments the projected point might not be part of the segment, but can be clamped to it.
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()
 
virtual double clampLambda (double lambda) const =0
 Clamps lambda to the extent of the line.
 

Member Function Documentation

◆ direction()

virtual vec3 direction ( ) const
pure virtual

Returns the normalized direction vector.

If the object has no well defined direction, e.g. a line segment of zero length, the return value will be zero.

Implemented in Line, and LineSegment.

◆ clampLambda()

virtual double clampLambda ( double lambda) const
pure virtual

Clamps lambda to the extent of the line.

Implemented in Line, and LineSegment.

◆ cylinderWallIntersection()

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.

Will return 0, 1 or 2 intersection points.


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