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


An infinite 2D line. More...

Public Member Functions

 Line2D ()
 Undefined (provided for creating Array<Line2D> only) More...
 
 Line2D (class BinaryInput &b)
 
virtual ~Line2D ()
 
Point2 closestPoint (const Point2 &pt) const
 Returns the closest point on the line to point. More...
 
void deserialize (class BinaryInput &b)
 
Vector2 direction () const
 Returns the direction (or negative direction) of the line. More...
 
double distance (const Point2 &point) const
 Returns the distance between point and the line. More...
 
Point2 intersection (const Line2D &otherLine) const
 
Returns the point where the lines intersect. More...
 
Point2 point () const
 Returns a point on the line. More...
 
void serialize (class BinaryOutput &b) const
 

Static Public Member Functions

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

Protected Member Functions

 Line2D (const Point2 &point, const Vector2 &direction)
 

Protected Attributes

Vector2 m_direction
 
Point2 m_point
 

Detailed Description


An infinite 2D line.

Constructor & Destructor Documentation

◆ Line2D() [1/3]

G3D::Line2D::Line2D ( const Point2 point,
const Vector2 direction 
)
inlineprotected

◆ Line2D() [2/3]

G3D::Line2D::Line2D ( )
inline

Undefined (provided for creating Array<Line2D> only)

Referenced by fromPointAndDirection(), and fromTwoPoints().

◆ Line2D() [3/3]

G3D::Line2D::Line2D ( class BinaryInput b)

◆ ~Line2D()

virtual G3D::Line2D::~Line2D ( )
inlinevirtual

Member Function Documentation

◆ closestPoint()

Point2 G3D::Line2D::closestPoint ( const Point2 pt) const

Returns the closest point on the line to point.

Referenced by distance().

◆ deserialize()

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

◆ direction()

Vector2 G3D::Line2D::direction ( ) const

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

Referenced by fromPointAndDirection(), and Line2D().

◆ distance()

double G3D::Line2D::distance ( const Point2 point) const
inline

Returns the distance between point and the line.

◆ fromPointAndDirection()

static Line2D G3D::Line2D::fromPointAndDirection ( const Point2 point,
const Vector2 direction 
)
inlinestatic

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

◆ fromTwoPoints()

static Line2D G3D::Line2D::fromTwoPoints ( const Point2 point1,
const Point2 point2 
)
inlinestatic

Constructs a line from two (not equal) points.

◆ intersection()

Point2 G3D::Line2D::intersection ( const Line2D otherLine) const


Returns the point where the lines intersect.

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

◆ point()

Point2 G3D::Line2D::point ( ) const

Returns a point on the line.

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

◆ serialize()

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

Member Data Documentation

◆ m_direction

Vector2 G3D::Line2D::m_direction
protected

Referenced by Line2D().

◆ m_point

Point2 G3D::Line2D::m_point
protected

Referenced by Line2D().


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