Loading...
Searching...
No Matches
GfLineSeg2d Class Reference

Basic type: 2D line segment. More...

#include <lineSeg2d.h>

Public Member Functions

 GfLineSeg2d ()
 The default constructor leaves line parameters undefined.
 
 GfLineSeg2d (const GfVec2d &p0, const GfVec2d &p1)
 Construct a line segment that spans two points.
 
GfVec2d GetPoint (double t) const
 Return the point on the segment specified by the parameter t.
 
const GfVec2dGetDirection () const
 Return the normalized direction of the line.
 
double GetLength () const
 Return the length of the line.
 
GF_API GfVec2d FindClosestPoint (const GfVec2d &point, double *t=NULL) const
 Returns the point on the line that is closest to point.
 
bool operator== (const GfLineSeg2d &l) const
 Component-wise equality test.
 
bool operator!= (const GfLineSeg2d &r) const
 Component-wise inequality test.
 

Friends

GF_API friend bool GfFindClosestPoints (const GfLine2d &, const GfLineSeg2d &, GfVec2d *, GfVec2d *, double *t1, double *t2)
 Computes the closets points on line and seg.
 
GF_API friend bool GfFindClosestPoints (const GfLineSeg2d &, const GfLineSeg2d &, GfVec2d *, GfVec2d *, double *, double *)
 Computes the closets points on two line segments, seg1 and seg2.
 

Detailed Description

Basic type: 2D line segment.

This class represents a three-dimensional line segment in space.

Definition at line 46 of file lineSeg2d.h.

Constructor & Destructor Documentation

◆ GfLineSeg2d() [1/2]

GfLineSeg2d ( )
inline

The default constructor leaves line parameters undefined.

Definition at line 51 of file lineSeg2d.h.

◆ GfLineSeg2d() [2/2]

GfLineSeg2d ( const GfVec2d p0,
const GfVec2d p1 
)
inline

Construct a line segment that spans two points.

Definition at line 55 of file lineSeg2d.h.

Member Function Documentation

◆ FindClosestPoint()

GF_API GfVec2d 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 closest point.

◆ GetDirection()

const GfVec2d & GetDirection ( ) const
inline

Return the normalized direction of the line.

Definition at line 64 of file lineSeg2d.h.

◆ GetLength()

double GetLength ( ) const
inline

Return the length of the line.

Definition at line 67 of file lineSeg2d.h.

◆ GetPoint()

GfVec2d GetPoint ( double  t) const
inline

Return the point on the segment specified by the parameter t.

p = p0 + t * (p1 - p0)

Definition at line 61 of file lineSeg2d.h.

◆ operator!=()

bool operator!= ( const GfLineSeg2d r) const
inline

Component-wise inequality test.

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

Definition at line 84 of file lineSeg2d.h.

◆ operator==()

bool operator== ( const GfLineSeg2d l) const
inline

Component-wise equality test.

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

Definition at line 77 of file lineSeg2d.h.

Friends And Related Function Documentation

◆ GfFindClosestPoints [1/2]

GF_API friend bool GfFindClosestPoints ( const GfLine2d ,
const GfLineSeg2d ,
GfVec2d ,
GfVec2d ,
double *  t1,
double *  t2 
)
friend

Computes the closets points on line and seg.

The two points are returned in p1 and p2. The parametric distances of p1 and p2 along the line and segment are 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.

◆ GfFindClosestPoints [2/2]

GF_API friend bool GfFindClosestPoints ( const GfLineSeg2d ,
const GfLineSeg2d ,
GfVec2d ,
GfVec2d ,
double *  ,
double *   
)
friend

Computes the closets points on two line segments, seg1 and seg2.

The two points are returned in p1 and p2. The parametric distances of p1 and p2 along the segments are 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: