RobWorkProject
23.9.11-
|
Describes a line segment in 2D. More...
#include <Line2D.hpp>
Public Types | |
enum | IntersectResult { PARALLEL , COINCIDENT , INTERSECTS } |
definition of intersection result values for the intersection test between two lines. More... | |
Public Member Functions | |
Line2D () | |
Constructor. | |
Line2D (const rw::math::Vector2D<> &p1, const rw::math::Vector2D<> &p2) | |
Creates a line between that intersect the two points p1 and p2. More... | |
Line2D (double x1, double y1, double x2, double y2) | |
Creates a line between that intersect the two points (x1,y1) and (x2,y2). More... | |
virtual | ~Line2D () |
Destructor. | |
IntersectResult | getIntersect (const Line2D &line, rw::math::Vector2D<> &res) const |
calculates the intersection between two lines. A intersection point is only saved in res if the two lines are not parallel or coincident. The intersection test does not take the segments into acount. More... | |
double | calcAngle (const Line2D &line) const |
calculates the angle between this line and line More... | |
double | calcAngle () const |
calculates the angle between the projection of this line onto yz-plane and the x-axis More... | |
double | calcDist (const rw::math::Vector2D<> &v) const |
calculates the shortest distance between point v and the infinite line. More... | |
double | getLength () const |
gets the length of thi line segment. More... | |
rw::math::Vector2D & | p1 () |
first point on the line | |
const rw::math::Vector2D & | p1 () const |
first point on the line More... | |
rw::math::Vector2D & | p2 () |
second point on the line | |
const rw::math::Vector2D & | p2 () const |
second point on the line More... | |
rw::math::Vector2D | calcUnitNormal () const |
calculates the unit normal of the line | |
Related Functions | |
(Note that these are not member functions.) | |
template<> | |
void | write (const rw::math::Line2D &sobject, rw::common::OutputArchive &oarchive, const std::string &id) |
template<> | |
void | read (rw::math::Line2D &sobject, rw::common::InputArchive &iarchive, const std::string &id) |
Describes a line segment in 2D.
enum IntersectResult |
Line2D | ( | const rw::math::Vector2D<> & | p1, |
const rw::math::Vector2D<> & | p2 | ||
) |
Creates a line between that intersect the two points p1 and p2.
p1 | [in] point |
p2 | [in] point |
Line2D | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Creates a line between that intersect the two points (x1,y1) and (x2,y2).
x1 | [in] x coordinate of point 1 |
y1 | [in] y coordinate of point 1 |
x2 | [in] x coordinate of point 2 |
y2 | [in] y coordinate of point 2 |
double calcAngle | ( | ) | const |
calculates the angle between the projection of this line onto yz-plane and the x-axis
double calcAngle | ( | const Line2D & | line | ) | const |
calculates the angle between this line and line
line | [in] a line |
double calcDist | ( | const rw::math::Vector2D<> & | v | ) | const |
calculates the shortest distance between point v and the infinite line.
v | [in] Point to which to calculate distance |
IntersectResult getIntersect | ( | const Line2D & | line, |
rw::math::Vector2D<> & | res | ||
) | const |
calculates the intersection between two lines. A intersection point is only saved in res if the two lines are not parallel or coincident. The intersection test does not take the segments into acount.
line | [in] the line two test against |
res | [out] the point of intersection |
|
inline |
gets the length of thi line segment.
|
inline |
first point on the line
|
inline |
second point on the line
|
related |
Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.
sobject | [out] the object in which the data should be streamed into |
iarchive | [in] the InputArchive from which to read data. |
id | [in] The id of the serialized sobject. |
|
related |
Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.
sobject | [in] the object from which the data should be streamed. |
oarchive | [out] the OutputArchive in which data should be written. |
id | [in] The id of the serialized sobject. |