Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
G3D::Line Class Reference


An infinite 3D line. More...

Public Member Functions

 Line ()
 Undefined (provided for creating Array<Line> only) More...
 
 Line (class BinaryInput &b)
 
 Line (const Any &a)
 
virtual ~Line ()
 
Vector3 closestPoint (const Vector3 &pt) const
 Returns the closest point on the line to point. More...
 
Vector3 closestPoint (const Line &B, float &minDist) const
 Finds the closest point to the two lines. More...
 
Vector3 closestPoint (const Line &B) const
 
void deserialize (class BinaryInput &b)
 
Vector3 direction () const
 Returns the direction (or negative direction) of the line. More...
 
double distance (const Vector3 &point) const
 Returns the distance between point and the line. More...
 
Vector3 intersection (const Plane &plane) const
 
Returns the point where the line and plane intersect. More...
 
Vector3 point () const
 Returns a point on the line. More...
 
void serialize (class BinaryOutput &b) const
 
Any toAny () const
 

Static Public Member Functions

static Line fromPointAndDirection (const Vector3 &point, const Vector3 &direction)
 Creates a line from a point and a (nonzero) direction. More...
 
static Line fromTwoPoints (const Vector3 &point1, const Vector3 &point2)
 Constructs a line from two (not equal) points. More...
 

Protected Member Functions

 Line (const Vector3 &point, const Vector3 &direction)
 

Protected Attributes

Vector3 _direction
 
Vector3 _point
 

Detailed Description


An infinite 3D line.

Constructor & Destructor Documentation

◆ Line() [1/4]

G3D::Line::Line ( const Vector3 point,
const Vector3 direction 
)
inlineprotected

◆ Line() [2/4]

G3D::Line::Line ( )
inline

Undefined (provided for creating Array<Line> only)

Referenced by fromPointAndDirection(), and fromTwoPoints().

◆ Line() [3/4]

G3D::Line::Line ( class BinaryInput b)

◆ Line() [4/4]

G3D::Line::Line ( const Any a)

◆ ~Line()

virtual G3D::Line::~Line ( )
inlinevirtual

Member Function Documentation

◆ closestPoint() [1/3]

Vector3 G3D::Line::closestPoint ( const Vector3 pt) const

Returns the closest point on the line to point.

Referenced by closestPoint(), and distance().

◆ closestPoint() [2/3]

Vector3 G3D::Line::closestPoint ( const Line B,
float &  minDist 
) const

Finds the closest point to the two lines.

Parameters
minDistReturns the minimum distance between the lines.
Referenced Code: http://objectmix.com/graphics/133793-coordinates-closest-points-pair-skew-lines.html

◆ closestPoint() [3/3]

Vector3 G3D::Line::closestPoint ( const Line B) const
inline

◆ deserialize()

void G3D::Line::deserialize ( class BinaryInput b)

◆ direction()

Vector3 G3D::Line::direction ( ) const

Returns the direction (or negative direction) of the line.

Referenced by fromPointAndDirection(), and Line().

◆ distance()

double G3D::Line::distance ( const Vector3 point) const
inline

Returns the distance between point and the line.

◆ fromPointAndDirection()

static Line G3D::Line::fromPointAndDirection ( const Vector3 point,
const Vector3 direction 
)
inlinestatic

Creates a line from a point and a (nonzero) direction.

◆ fromTwoPoints()

static Line G3D::Line::fromTwoPoints ( const Vector3 point1,
const Vector3 point2 
)
inlinestatic

Constructs a line from two (not equal) points.

◆ intersection()

Vector3 G3D::Line::intersection ( const Plane plane) const


Returns the point where the line and plane intersect.

If there is no intersection, returns a point at infinity.

◆ point()

Vector3 G3D::Line::point ( ) const

Returns a point on the line.

Referenced by distance(), fromPointAndDirection(), and Line().

◆ serialize()

void G3D::Line::serialize ( class BinaryOutput b) const

◆ toAny()

Any G3D::Line::toAny ( ) const

Member Data Documentation

◆ _direction

Vector3 G3D::Line::_direction
protected

Referenced by Line().

◆ _point

Vector3 G3D::Line::_point
protected

Referenced by Line().


documentation generated on Wed Nov 24 2021 08:01:57 using doxygen 1.8.15