This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GfLine Class Reference

Basic type: 3D line. More...

#include <line.h>

Public Member Functions

 GfLine ()
 The default constructor leaves line parameters undefined.
 
 GfLine (const GfVec3d &p0, const GfVec3d &dir)
 Construct a line from a point and a direction.
 
double Set (const GfVec3d &p0, const GfVec3d &dir)
 
GfVec3d GetPoint (double t) const
 Return the point on the line at ( p0 + t * dir ).
 
const GfVec3dGetDirection () const
 Return the normalized direction of the line.
 
GF_API GfVec3d FindClosestPoint (const GfVec3d &point, double *t=NULL) const
 Returns the point on the line that is closest to point.
 
bool operator== (const GfLine &l) const
 Component-wise equality test.
 
bool operator!= (const GfLine &r) const
 Component-wise inequality test.
 

Friends

GF_API friend bool GfFindClosestPoints (const GfLine &, const GfLine &, GfVec3d *, GfVec3d *, double *, double *)
 Computes the closets points between two lines.
 

Detailed Description

Basic type: 3D line.

This class represents a three-dimensional line in space. Lines are constructed from a point, p0, and a direction, dir. The direction is normalized in the constructor.

The line is kept in a parametric represention, p = p0 + t * dir.

Definition at line 32 of file line.h.

Constructor & Destructor Documentation

◆ GfLine() [1/2]

GfLine ( )
inline

The default constructor leaves line parameters undefined.

Definition at line 37 of file line.h.

◆ GfLine() [2/2]

GfLine ( const GfVec3d p0,
const GfVec3d dir 
)
inline

Construct a line from a point and a direction.

Definition at line 41 of file line.h.

Member Function Documentation

◆ FindClosestPoint()

GF_API GfVec3d FindClosestPoint ( const GfVec3d point,
double *  t = NULL 
) const

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

If t is not NULL, it will be set to the parametric distance along the line of the returned point.

◆ GetDirection()

const GfVec3d & GetDirection ( ) const
inline

Return the normalized direction of the line.

Definition at line 56 of file line.h.

◆ GetPoint()

GfVec3d GetPoint ( double  t) const
inline

Return the point on the line at ( p0 + t * dir ).

Remember dir has been normalized so t represents a unit distance.

Definition at line 53 of file line.h.

◆ operator!=()

bool operator!= ( const GfLine r) const
inline

Component-wise inequality test.

The starting points, and directions must match exactly for lines to be considered equal.

Definition at line 72 of file line.h.

◆ operator==()

bool operator== ( const GfLine l) const
inline

Component-wise equality test.

The starting points and directions, must match exactly for lines to be considered equal.

Definition at line 66 of file line.h.

◆ Set()

double Set ( const GfVec3d p0,
const GfVec3d dir 
)
inline

Definition at line 45 of file line.h.

Friends And Related Function Documentation

◆ GfFindClosestPoints

GF_API friend bool GfFindClosestPoints ( const GfLine ,
const GfLine ,
GfVec3d ,
GfVec3d ,
double *  ,
double *   
)
friend

Computes the closets points between two lines.

The two points are returned in p1 and p2. The parametric distance of each point on the lines is returned in t1 and t2.

This returns false if the lines were close enough to parallel that no points could be computed; in this case, the other return values are undefined.


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