HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfLine2d Class Reference

#include <line2d.h>

Public Member Functions

 GfLine2d ()
 The default constructor leaves line parameters undefined. More...
 
 GfLine2d (const GfVec2d &p0, const GfVec2d &dir)
 Construct a line from a point and a direction. More...
 
double Set (const GfVec2d &p0, const GfVec2d &dir)
 
GfVec2d GetPoint (double t) const
 
const GfVec2dGetDirection () const
 Return the normalized direction of the line. More...
 
GF_API GfVec2d FindClosestPoint (const GfVec2d &point, double *t=NULL) const
 
bool operator== (const GfLine2d &l) const
 
bool operator!= (const GfLine2d &r) const
 

Friends

GF_API friend bool GfFindClosestPoints (const GfLine2d &, const GfLine2d &, GfVec2d *, GfVec2d *, double *, double *)
 

Detailed Description

Basic type: 2D line

This class represents a two-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 49 of file line2d.h.

Constructor & Destructor Documentation

GfLine2d::GfLine2d ( )
inline

The default constructor leaves line parameters undefined.

Definition at line 54 of file line2d.h.

GfLine2d::GfLine2d ( const GfVec2d p0,
const GfVec2d dir 
)
inline

Construct a line from a point and a direction.

Definition at line 58 of file line2d.h.

Member Function Documentation

GF_API GfVec2d GfLine2d::FindClosestPoint ( const GfVec2d 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.

const GfVec2d& GfLine2d::GetDirection ( ) const
inline

Return the normalized direction of the line.

Definition at line 73 of file line2d.h.

GfVec2d GfLine2d::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 70 of file line2d.h.

bool GfLine2d::operator!= ( const GfLine2d r) const
inline

Component-wise inequality test. The starting points, and directions must match exactly for lines to be considered equal.

Definition at line 89 of file line2d.h.

bool GfLine2d::operator== ( const GfLine2d l) const
inline

Component-wise equality test. The starting points and directions, must match exactly for lines to be considered equal.

Definition at line 83 of file line2d.h.

double GfLine2d::Set ( const GfVec2d p0,
const GfVec2d dir 
)
inline

Definition at line 62 of file line2d.h.

Friends And Related Function Documentation

GF_API friend bool GfFindClosestPoints ( const GfLine2d ,
const GfLine2d ,
GfVec2d ,
GfVec2d ,
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: