Hermes
hermes::Line2 Class Reference

Represents a 2D line by a point and a vector. More...

Public Member Functions

 Line2 (point2 _a, vec2 _d)
 
point2 operator() (float t) const
 
vec2 direction () const
 
float projection (point2 p) const
 
point2 closestPoint (point2 p) const
 

Public Attributes

point2 a
 line point
 
vec2 d
 line direction
 

Friends

std::ostream & operator<< (std::ostream &os, const Line2 &p)
 

Detailed Description

Represents a 2D line by a point and a vector.

Constructor & Destructor Documentation

◆ Line2()

hermes::Line2::Line2 ( point2  _a,
vec2  _d 
)
inline
Parameters
_aline point
_ddirection

Member Function Documentation

◆ closestPoint()

point2 hermes::Line2::closestPoint ( point2  p) const
inline
Parameters
ppoint
Returns
closest point in line from p

◆ direction()

vec2 hermes::Line2::direction ( ) const
inline
Returns
unit vector representing line direction

◆ operator()()

point2 hermes::Line2::operator() ( float  t) const
inline
Parameters
tparametric coordinate
Returns
euclidean point from parametric coordinate t

◆ projection()

float hermes::Line2::projection ( point2  p) const
inline
Parameters
ppoint
Returns
parametric coordinate of p projection into line

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