ACF $AcfVersion:0$
Public Member Functions | List of all members
i3d::CLine3d Class Reference

Definition of a line in 3D space. More...

#include <CLine3d.h>

Public Member Functions

 CLine3d ()
 Default constructor.
 
 CLine3d (const CVector3d &p1, const CVector3d &p2)
 Construct line from two points.
 
bool IsNull () const
 Returns true if the line has zero length.
 
const CVector3dGetPoint1 () const
 Get first point of the line.
 
void SetPoint1 (const CVector3d &point)
 Set first point of the line.
 
const CVector3dGetPoint2 () const
 Get second point of the line.
 
void SetPoint2 (const CVector3d &point)
 Set second point of the line.
 
CVector3d GetDirection () const
 Get direction vector of the line (normalized).
 
double GetLength () const
 Get length of the line segment.
 
double GetLengthSq () const
 Get squared length of the line segment (faster than GetLength).
 
CVector3d GetPointAt (double t) const
 Get point at parameter t.
 
CVector3d GetClosestPoint (const CVector3d &point) const
 Get closest point on line to given point.
 
double GetClosestParameter (const CVector3d &point) const
 Get parameter value t for closest point on line to given point.
 
double GetDistance (const CVector3d &point) const
 Calculate distance from point to line segment.
 
double GetDistanceSq (const CVector3d &point) const
 Calculate squared distance from point to line segment (faster).
 
bool Serialize (iser::IArchive &archive)
 Serialize this line to specified archive.
 
bool operator== (const CLine3d &line) const
 
bool operator!= (const CLine3d &line) const
 

Detailed Description

Definition of a line in 3D space.

Line is stored as two points or equivalently as point and direction.

Definition at line 17 of file CLine3d.h.

Constructor & Destructor Documentation

◆ CLine3d() [1/2]

i3d::CLine3d::CLine3d ( )
inline

Default constructor.

Creates a line along X axis through origin.

Definition at line 119 of file CLine3d.h.

◆ CLine3d() [2/2]

i3d::CLine3d::CLine3d ( const CVector3d p1,
const CVector3d p2 
)
inline

Construct line from two points.

Parameters
p1First point on line.
p2Second point on line.

Definition at line 126 of file CLine3d.h.

Member Function Documentation

◆ GetClosestParameter()

double i3d::CLine3d::GetClosestParameter ( const CVector3d point) const

Get parameter value t for closest point on line to given point.

Parameters
pointPoint to find closest point to.
Returns
Parameter t (0 to 1 for segment, can be outside for infinite line).

◆ GetClosestPoint()

CVector3d i3d::CLine3d::GetClosestPoint ( const CVector3d point) const

Get closest point on line to given point.

Parameters
pointPoint to find closest point to.
Returns
Closest point on the line segment.

◆ GetDirection()

CVector3d i3d::CLine3d::GetDirection ( ) const
inline

Get direction vector of the line (normalized).

Definition at line 163 of file CLine3d.h.

References i3d::CVector3d::GetNormalized().

◆ GetDistance()

double i3d::CLine3d::GetDistance ( const CVector3d point) const

Calculate distance from point to line segment.

Referenced by i3d::Geometry::GetDistance().

◆ GetDistanceSq()

double i3d::CLine3d::GetDistanceSq ( const CVector3d point) const

Calculate squared distance from point to line segment (faster).

◆ GetLength()

double i3d::CLine3d::GetLength ( ) const
inline

Get length of the line segment.

Definition at line 169 of file CLine3d.h.

References imath::TVector< Size, Element >::GetLength().

◆ GetLengthSq()

double i3d::CLine3d::GetLengthSq ( ) const
inline

Get squared length of the line segment (faster than GetLength).

Definition at line 175 of file CLine3d.h.

◆ GetPoint1()

const CVector3d & i3d::CLine3d::GetPoint1 ( ) const
inline

Get first point of the line.

Definition at line 139 of file CLine3d.h.

◆ GetPoint2()

const CVector3d & i3d::CLine3d::GetPoint2 ( ) const
inline

Get second point of the line.

Definition at line 151 of file CLine3d.h.

◆ GetPointAt()

CVector3d i3d::CLine3d::GetPointAt ( double  t) const
inline

Get point at parameter t.

t=0 gives point1, t=1 gives point2.

Definition at line 181 of file CLine3d.h.

◆ IsNull()

bool i3d::CLine3d::IsNull ( ) const
inline

Returns true if the line has zero length.

Definition at line 133 of file CLine3d.h.

◆ operator!=()

bool i3d::CLine3d::operator!= ( const CLine3d line) const
inline

Definition at line 193 of file CLine3d.h.

◆ operator==()

bool i3d::CLine3d::operator== ( const CLine3d line) const
inline

Definition at line 187 of file CLine3d.h.

◆ Serialize()

bool i3d::CLine3d::Serialize ( iser::IArchive archive)

Serialize this line to specified archive.

◆ SetPoint1()

void i3d::CLine3d::SetPoint1 ( const CVector3d point)
inline

Set first point of the line.

Definition at line 145 of file CLine3d.h.

◆ SetPoint2()

void i3d::CLine3d::SetPoint2 ( const CVector3d point)
inline

Set second point of the line.

Definition at line 157 of file CLine3d.h.


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