modm API documentation
modm::LineSegment2D< T > Class Template Reference

Line segment. More...

`#include <modm/math/geometry/line_segment_2d.hpp>`

Public Typedefs

typedef GeometricTraits< T >::WideType WideType

typedef GeometricTraits< T >::FloatType FloatType

Public Member Functions

LineSegment2D (const Vector< T, 2 > &start, const Vector< T, 2 > &end)

void setStartPoint (const Vector< T, 2 > &point)
Set the starting point of the line segment.

const Vector< T, 2 > & getStartPoint () const

void setEndPoint (const Vector< T, 2 > &point)
Set the end point of the line segment.

const Vector< T, 2 > & getEndPoint () const

void set (const Vector< T, 2 > &start, const Vector< T, 2 > &end)

void translate (const Vector< T, 2 > &vector)

getLength () const
Length of the line segment.

Vector< T, 2 > getDirectionVector () const

const T getDistanceTo (const Vector< T, 2 > &point) const
Shortest distance to a point.

const Vector< T, 2 > getClosestPointTo (const Vector< T, 2 > &point) const
Calculate the point on the line segment closes to the given point.

bool intersects (const LineSegment2D &other) const
Check if two line segments intersect. More...

bool intersects (const Polygon2D< T > &polygon) const
Check if a intersection exists.

bool getIntersections (const LineSegment2D &other, PointSet2D< T > &intersectionPoints) const
Calculate the intersection point.

bool getIntersections (const Circle2D< T > &circle, PointSet2D< T > &intersectionPoints) const
Calculate the intersection point(s) More...

bool getIntersections (const Polygon2D< T > &polygon, PointSet2D< T > &intersectionPoints) const

bool operator== (const LineSegment2D &other) const

bool operator!= (const LineSegment2D &other) const

Protected Attributes

modm::Vector< T, 2 > startPoint

modm::Vector< T, 2 > endPoint

Line segment.

Member Function Documentation

template<typename T = int16_t>
 bool modm::LineSegment2D< T >::getIntersections ( const Circle2D< T > & circle, PointSet2D< T > & intersectionPoints ) const

Calculate the intersection point(s)