ML Reference
ml::Line Class Reference

Class to define the geometry primitive "Line" consisting of a position and a direction. More...

#include <mlLine.h>

Public Member Functions

 Line ()
 Constructor. Position is set to (0,0,0) and dir is set to (1,0,0).
 
 Line (const Vector3 &p0, const Vector3 &p1)
 Constructor for line passing p0 and p1.
 
bool setValue (const Vector3 &p0, const Vector3 &p1)
 Initializes line passing through p0 and p1.
 
Vector3 getClosestPoint (const Vector3 &point) const
 Returns the point on the line which is closest to point.
 
double distance (const Vector3 &point) const
 Returns the distance of point to the line.
 
const Vector3getPosition () const
 Returns the reference point on the line.
 
const Vector3getDirection () const
 Returns the direction of the line.
 
Vector3 getVector (double lambda) const
 Returns a point on line parametrized by lambda.
 
bool getClosestPoints (const Line &line2, Vector3 &pointOnLine, Vector3 &pointOnLine2) const
 Finds the two closest points on this and line2 and stores them in pointOnLine and pointOnLine2, respectively.
 

Detailed Description

Class to define the geometry primitive "Line" consisting of a position and a direction.

Definition at line 27 of file mlLine.h.

Constructor & Destructor Documentation

◆ Line() [1/2]

ml::Line::Line ( )

Constructor. Position is set to (0,0,0) and dir is set to (1,0,0).

◆ Line() [2/2]

ml::Line::Line ( const Vector3 & p0,
const Vector3 & p1 )

Constructor for line passing p0 and p1.

Member Function Documentation

◆ distance()

double ml::Line::distance ( const Vector3 & point) const

Returns the distance of point to the line.

◆ getClosestPoint()

Vector3 ml::Line::getClosestPoint ( const Vector3 & point) const

Returns the point on the line which is closest to point.

◆ getClosestPoints()

bool ml::Line::getClosestPoints ( const Line & line2,
Vector3 & pointOnLine,
Vector3 & pointOnLine2 ) const

Finds the two closest points on this and line2 and stores them in pointOnLine and pointOnLine2, respectively.

Returns true if lines are not parallel.

◆ getDirection()

const Vector3 & ml::Line::getDirection ( ) const
inline

Returns the direction of the line.

Definition at line 53 of file mlLine.h.

◆ getPosition()

const Vector3 & ml::Line::getPosition ( ) const
inline

Returns the reference point on the line.

Definition at line 49 of file mlLine.h.

◆ getVector()

Vector3 ml::Line::getVector ( double lambda) const
inline

Returns a point on line parametrized by lambda.

Definition at line 57 of file mlLine.h.

◆ setValue()

bool ml::Line::setValue ( const Vector3 & p0,
const Vector3 & p1 )

Initializes line passing through p0 and p1.

Returns true if p0 != p1, otherwise the direction of the line is left unchanged and false is returned.


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