LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
rcsc::Line2D Class Reference

2d straight line class More...

#include <line_2d.h>

Public Member Functions

 Line2D (const double a, const double b, const double c)
 construct directly More...
 
 Line2D (const Vector2D &p1, const Vector2D &p2)
 construct from 2 points More...
 
 Line2D (const Vector2D &origin, const AngleDeg &linedir)
 construct from origin point + direction More...
 
const Line2Dassign (const Vector2D &p1, const Vector2D &p2)
 construct from 2 points More...
 
const Line2Dassign (const Vector2D &origin, const AngleDeg &linedir)
 construct from origin point + direction More...
 
double a () const
 accessor More...
 
double b () const
 accessor More...
 
double c () const
 accessor More...
 
double getX (const double y) const
 get X-coordinate correspond to 'y' More...
 
double getY (const double x) const
 get Y-coordinate correspond to 'x' More...
 
double dist (const Vector2D &p) const
 calculate distance from point to this line More...
 
double dist2 (const Vector2D &p) const
 get squared distance from this line to point More...
 
bool isParallel (const Line2D &line) const
 check if the slope of this line is same to the slope of 'line' More...
 
Vector2D intersection (const Line2D &line) const
 get the intersection point with 'line' More...
 
Line2D perpendicular (const Vector2D &p) const
 calc perpendicular line (SUI-SEN) More...
 
Vector2D projection (const Vector2D &p) const
 calc projection point from p More...
 

Static Public Member Functions

static Vector2D intersection (const Line2D &line1, const Line2D &line2)
 get the intersection point of 2 lines More...
 
static Line2D angle_bisector (const Vector2D &origin, const AngleDeg &left, const AngleDeg &right)
 make angle bisector line from two angles More...
 
static Line2D perpendicular_bisector (const Vector2D &p1, const Vector2D &p2)
 make perpendicular bisector line from twt points More...
 

Static Public Attributes

static const double EPSILON
 tolerance threshold
 
static const double ERROR_VALUE
 error value
 

Detailed Description

2d straight line class

Line Fomula: aX + bY + c = 0

Constructor & Destructor Documentation

◆ Line2D() [1/3]

rcsc::Line2D::Line2D ( const double  a,
const double  b,
const double  c 
)
inline

construct directly

Parameters
aLine formula A, coefficient for x
bLine formula B, coefficient for y
cconstant C

◆ Line2D() [2/3]

rcsc::Line2D::Line2D ( const Vector2D p1,
const Vector2D p2 
)
inline

construct from 2 points

Parameters
p1first point
p2second point

◆ Line2D() [3/3]

rcsc::Line2D::Line2D ( const Vector2D origin,
const AngleDeg linedir 
)
inline

construct from origin point + direction

Parameters
originorigin point
linedirdirection from origin point

Member Function Documentation

◆ a()

double rcsc::Line2D::a ( ) const
inline

accessor

Returns
coefficient 'A' of line formula

◆ angle_bisector()

static Line2D rcsc::Line2D::angle_bisector ( const Vector2D origin,
const AngleDeg left,
const AngleDeg right 
)
inlinestatic

make angle bisector line from two angles

Parameters
originorigin point that is passed through by result line
leftleft angle
rightright angle
Returns
line object

◆ assign() [1/2]

const Line2D & rcsc::Line2D::assign ( const Vector2D origin,
const AngleDeg linedir 
)
inline

construct from origin point + direction

Parameters
originorigin point
linedirdirection from origin point
Returns
const reference to itself

◆ assign() [2/2]

const Line2D & rcsc::Line2D::assign ( const Vector2D p1,
const Vector2D p2 
)
inline

construct from 2 points

Parameters
p1first point
p2second point
Returns
const reference to itself

◆ b()

double rcsc::Line2D::b ( ) const
inline

accessor

Returns
coefficient 'B' of line formula

◆ c()

double rcsc::Line2D::c ( ) const
inline

accessor

Returns
coefficient 'C' of line formula

◆ dist()

double rcsc::Line2D::dist ( const Vector2D p) const
inline

calculate distance from point to this line

Parameters
pconsidrered point
Returns
distance value

◆ dist2()

double rcsc::Line2D::dist2 ( const Vector2D p) const
inline

get squared distance from this line to point

Parameters
pconsidrered point
Returns
squared distance value

◆ getX()

double rcsc::Line2D::getX ( const double  y) const
inline

get X-coordinate correspond to 'y'

Parameters
yconsidered Y
Returns
X coordinate

◆ getY()

double rcsc::Line2D::getY ( const double  x) const
inline

get Y-coordinate correspond to 'x'

Parameters
xconsidered X
Returns
Y coordinate

◆ intersection() [1/2]

Vector2D rcsc::Line2D::intersection ( const Line2D line) const
inline

get the intersection point with 'line'

Parameters
lineconsidered line
Returns
intersection point. if it does not exist, the invaidated value vector is returned.

◆ intersection() [2/2]

static Vector2D rcsc::Line2D::intersection ( const Line2D line1,
const Line2D line2 
)
static

get the intersection point of 2 lines

Parameters
line1the first line
line2the second line
Returns
the intersection point. if no intersection, invalid vector is returned.

◆ isParallel()

bool rcsc::Line2D::isParallel ( const Line2D line) const
inline

check if the slope of this line is same to the slope of 'line'

Parameters
lineconsidered line
Return values
truealmost same
falsenot same

◆ perpendicular()

Line2D rcsc::Line2D::perpendicular ( const Vector2D p) const
inline

calc perpendicular line (SUI-SEN)

Parameters
pthe point that perpendicular line pass through
Returns
perpendicular line

◆ perpendicular_bisector()

static Line2D rcsc::Line2D::perpendicular_bisector ( const Vector2D p1,
const Vector2D p2 
)
static

make perpendicular bisector line from twt points

Parameters
p11st point
p22nd point
Returns
line object

◆ projection()

Vector2D rcsc::Line2D::projection ( const Vector2D p) const
inline

calc projection point from p

Parameters
pbase point
Returns
projection point

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