GT RoboCup SSL
Soccer software, robot firmware
Geometry2d::Line Class Reference

Public Member Functions

 Line (Point p1, Point p2)
 
 Line (const Segment &other)
 
Point delta () const
 
bool operator== (const Line &other)
 
float distTo (Point other) const
 returns the shortest distance between the line and a point More...
 
void transform (const TransformMatrix &t)
 Applies a transformation matrix to the line. More...
 
bool intersects (const Line &other, Point *intersection=nullptr) const
 Test for line intersections. More...
 
bool intersects (const Segment &other, Point *intersection=nullptr) const
 
bool intersects (const Circle &circle, Point *p1=nullptr, Point *p2=nullptr) const
 returns the points of intersection b/t circle and line
 
float pointSide (const Point &p) const
 tells you which side of the line you are on More...
 
Point nearestPoint (Point p) const
 Returns the point on the line closest to p.
 
std::string toString ()
 

Static Public Member Functions

static bool intersects (const Line &line1, const Line &line2, Point *intersection=nullptr)
 

Public Attributes

Point pt [2]
 the line consists of two points
 
+ Collaboration diagram for Geometry2d::Line:

Member Function Documentation

◆ distTo()

float Geometry2d::Line::distTo ( Point  other) const

returns the shortest distance between the line and a point

Parameters
otherthe point to find the distance to
Returns
the distance to the point from the line

◆ intersects()

bool Geometry2d::Line::intersects ( const Line other,
Point intersection = nullptr 
) const

Test for line intersections.

If the two lines intersect, then the function returns true, else false. Also, if the lines intersect, then intr is set to the intersection point.

Parameters
otherthe line to test for intersection with
intrset to the intersection point if the lines intersect
Returns
true if the lines intersect, false otherwise

◆ pointSide()

float Geometry2d::Line::pointSide ( const Point p) const
inline

tells you which side of the line you are on

Returns
the sine of the non-zero portion of the cross product

◆ transform()

void Geometry2d::Line::transform ( const TransformMatrix t)
inline

Applies a transformation matrix to the line.

Parameters
tthe transformation matrix to perform on the line

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