Public Member Functions | Protected Attributes | Friends | List of all members
tuw::LineSegment2D Class Reference

#include <linesegment2d.h>

Inheritance diagram for tuw::LineSegment2D:
Inheritance graph
[legend]

Public Member Functions

double angle () const
 
double closestPointLineSegmentRatio (const Point2D &p) const
 
Point2D closestPointTo (const Point2D &p) const
 
double distanceSqrTo (const Point2D &p, double &dx, double &dy) const
 
double distanceTo (const Point2D &p, double &dx, double &dy) const
 
double distanceTo (const Point2D &p) const
 
const double length () const
 
const Line2Dline () const
 
 LineSegment2D ()
 the lines endpoints More...
 
 LineSegment2D (const LineSegment2D &l)
 
 LineSegment2D (const Point2D &p0, const Point2D &p1)
 
 LineSegment2D (const double &x0, const double &y0, const double &x1, const double &y1)
 
bool operator== (const LineSegment2D &o) const
 comparison operator More...
 
const Point2Dp0 () const
 
const Point2Dp1 () const
 
Point2D pc () const
 
LineSegment2Dset (const double &x0, const double &y0, const double &x1, const double &y1)
 
LineSegment2Dset (const Point2D &p0, const Point2D &p1)
 
const double & x0 () const
 
const double & x1 () const
 
const double & y0 () const
 
const double & y1 () const
 
- Public Member Functions inherited from tuw::Line2D
double & a ()
 
const double & a () const
 
double & b ()
 
const double & b () const
 
double & c ()
 
const double & c () const
 
cv::Vec< double, 3 > & cv ()
 
const cv::Vec< double, 3 > & cv () const
 
double distanceTo (const double &x, const double &y) const
 
double distanceTo (const Point2D &p) const
 
Point2D intersection (const Line2D &l) const
 
 Line2D ()
 constructor More...
 
 Line2D (const Line2D &l)
 
 Line2D (cv::Vec< double, 3 > &l, bool normalize=true)
 
 Line2D (const double &x0, const double &y0, const double &x1, const double &y1, bool normalize=true)
 
 Line2D (const Point2D &pt1, const Point2D &pt2, bool normalize=true)
 
cv::Vec< double, 2 > normal () const
 
void normalize ()
 
Point2D pointOnLine (const double &x, const double &y) const
 
Point2D pointOnLine (const Point2D &p) const
 
Line2Dset (const double &x0, const double &y0, const double &x1, const double &y1, bool normalize=true)
 
Line2Dset (const Point2D &p0, const Point2D &p1, bool normalize=true)
 
Polar2D toPolar () const
 

Protected Attributes

Point2D p0_
 
Point2D p1_
 

Friends

std::ostream & operator<< (std::ostream &os, const LineSegment2D &o)
 

Detailed Description

class to represent a 2D line with its endpoints and as equation a*x + b*y + c = 0

Definition at line 15 of file linesegment2d.h.

Constructor & Destructor Documentation

LineSegment2D::LineSegment2D ( )

the lines endpoints

constructor

Definition at line 4 of file linesegment2d.cpp.

LineSegment2D::LineSegment2D ( const LineSegment2D l)

copy constructor

Parameters
lLineSegment2D

Definition at line 5 of file linesegment2d.cpp.

LineSegment2D::LineSegment2D ( const Point2D p0,
const Point2D p1 
)

constructor to create a line from points

Parameters
p0
p1

Definition at line 10 of file linesegment2d.cpp.

LineSegment2D::LineSegment2D ( const double &  x0,
const double &  y0,
const double &  x1,
const double &  y1 
)

constructor to create a line from points

Parameters
x0
y0
x1
y1

Definition at line 15 of file linesegment2d.cpp.

Member Function Documentation

double LineSegment2D::angle ( ) const

orientation of the line in space angle between -PI and PI

Definition at line 32 of file linesegment2d.cpp.

double LineSegment2D::closestPointLineSegmentRatio ( const Point2D p) const

Definition at line 96 of file linesegment2d.cpp.

Point2D LineSegment2D::closestPointTo ( const Point2D p) const

computes closest point along segment

Parameters
ppoint
Returns
closest point along segment to the given point

Definition at line 105 of file linesegment2d.cpp.

double LineSegment2D::distanceSqrTo ( const Point2D p,
double &  dx,
double &  dy 
) const

computes distance to line segment

See also
http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
Parameters
ppoint
dxvector to point x
dxvector to point y
Returns
distance to line between the segment endpoints or the distance to the nearest endpoints

computes squared distance to line segment

See also
http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
Parameters
ppoint
dxvector to point x
dxvector to point y
Returns
distance to line between the segment endpoints or the distance to the nearest endpoints

Definition at line 82 of file linesegment2d.cpp.

double LineSegment2D::distanceTo ( const Point2D p,
double &  dx,
double &  dy 
) const

computes distance to line segment

See also
http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
Parameters
ppoint
dxvector to point x
dxvector to point y
Returns
distance to line between the segment endpoints or the distance to the nearest endpoints

Definition at line 73 of file linesegment2d.cpp.

double LineSegment2D::distanceTo ( const Point2D p) const

computes distance to line segment

See also
http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
Returns
distance to line between the segment endpoints or the distance to the nearest endpoints

computes distance to line segment

See also
http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
Parameters
ppoint
Returns
distance to line between the segment endpoints or the distance to the nearest endpoints

Definition at line 116 of file linesegment2d.cpp.

const double LineSegment2D::length ( ) const
Returns
length of the line

Definition at line 51 of file linesegment2d.cpp.

const Line2D & LineSegment2D::line ( ) const
Returns
the line function of the base class

Definition at line 48 of file linesegment2d.cpp.

bool LineSegment2D::operator== ( const LineSegment2D o) const

comparison operator

comparison operator

Returns
true on equal
true on equal

Definition at line 55 of file linesegment2d.cpp.

const Point2D & LineSegment2D::p0 ( ) const
Returns
startpoint

Definition at line 42 of file linesegment2d.cpp.

const Point2D & LineSegment2D::p1 ( ) const
Returns
endpoint

Definition at line 45 of file linesegment2d.cpp.

Point2D LineSegment2D::pc ( ) const
Returns
center point between p0 and p1

Definition at line 37 of file linesegment2d.cpp.

LineSegment2D & LineSegment2D::set ( const double &  x0,
const double &  y0,
const double &  x1,
const double &  y1 
)

sets a line from points

Parameters
x0
y0
x1
y1

Definition at line 58 of file linesegment2d.cpp.

LineSegment2D & LineSegment2D::set ( const Point2D p0,
const Point2D p1 
)

sets a line from points

Parameters
p0
p1

Definition at line 63 of file linesegment2d.cpp.

const double & LineSegment2D::x0 ( ) const
Returns
startpoint x

Definition at line 20 of file linesegment2d.cpp.

const double & LineSegment2D::x1 ( ) const
Returns
endpoint x

Definition at line 26 of file linesegment2d.cpp.

const double & LineSegment2D::y0 ( ) const
Returns
startpoint y

Definition at line 23 of file linesegment2d.cpp.

const double & LineSegment2D::y1 ( ) const
Returns
endpoint y

Definition at line 29 of file linesegment2d.cpp.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const LineSegment2D o 
)
friend

Definition at line 128 of file linesegment2d.h.

Member Data Documentation

Point2D tuw::LineSegment2D::p0_
protected

Definition at line 17 of file linesegment2d.h.

Point2D tuw::LineSegment2D::p1_
protected

Definition at line 17 of file linesegment2d.h.


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


tuw_geometry
Author(s): Markus Bader
autogenerated on Mon Jun 10 2019 15:33:09