Line segment in two dimensions.
More...
#include <JSegment2D.hh>
Line segment in two dimensions.
Definition at line 35 of file JSegment2D.hh.
◆ JSegment2D() [1/2]
JGEOMETRY2D::JSegment2D::JSegment2D |
( |
| ) |
|
|
inline |
◆ JSegment2D() [2/2]
Constructor.
- Parameters
-
A | start position |
B | end position |
Definition at line 53 of file JSegment2D.hh.
◆ getLengthSquared()
double JGEOMETRY2D::JSegment2D::getLengthSquared |
( |
| ) |
const |
|
inline |
Get length squared.
- Returns
- square of length
Definition at line 64 of file JSegment2D.hh.
◆ getLength()
double JGEOMETRY2D::JSegment2D::getLength |
( |
| ) |
const |
|
inline |
◆ intersects()
bool JGEOMETRY2D::JSegment2D::intersects |
( |
const JSegment2D & |
segment | ) |
const |
|
inline |
Test whether two line segments intersect.
- Parameters
-
- Returns
- true if two line segment intersect; else false
Definition at line 87 of file JSegment2D.hh.
89 return (
getCCW(this->first, segment.first, this->second) !=
getCCW(this->first, segment.second, this->second) &&
90 getCCW(segment.first, this->first, segment.second) !=
getCCW(segment.first, this->second, segment.second));
◆ getIntersection()
Get intersection of two line segments.
- Parameters
-
- Returns
- intersection point
Definition at line 100 of file JSegment2D.hh.
102 JVector2D da(this->second - this->first);
103 JVector2D db(segment.second - segment.first);
118 throw JDivisionByZero(
"JSegment2D::getIntersection()");
◆ getDistanceSquared()
double JGEOMETRY2D::JSegment2D::getDistanceSquared |
( |
const JVector2D & |
point | ) |
const |
|
inline |
Get squared of distance to point.
- Parameters
-
- Returns
- square of distance
Definition at line 129 of file JSegment2D.hh.
133 const double gp = D.getLengthSquared();
139 double u = D.getDot(U);
151 return D.getLengthSquared();
155 return first.getDistanceSquared(point);
◆ getDistance()
double JGEOMETRY2D::JSegment2D::getDistance |
( |
const JVector2D & |
point | ) |
const |
|
inline |
Get distance to point.
- Parameters
-
- Returns
- distance
Definition at line 166 of file JSegment2D.hh.
◆ getDot()
double JGEOMETRY2D::JSegment2D::getDot |
( |
const JSegment2D & |
segment | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 178 of file JSegment2D.hh.
180 return JVector2D(this->second - this->first).
getDot(segment.second - segment.first);
◆ operator>>
Read segment from input.
- Parameters
-
- Returns
- reader
Definition at line 191 of file JSegment2D.hh.
194 in >> segment.second;
◆ operator<<
Write segment to output.
- Parameters
-
- Returns
- writer
Definition at line 207 of file JSegment2D.hh.
209 out << segment.first;
210 out << segment.second;
The documentation for this class was generated from the following file: