90 return (
getCCW(this->first, segment.first, this->second) !=
getCCW(this->first, segment.second, this->second) &&
91 getCCW(segment.first, this->first, segment.second) !=
getCCW(segment.first, this->second, segment.second));
103 JVector2D da(this->second - this->first);
104 JVector2D db(segment.second - segment.first);
156 return first.getDistanceSquared(point);
181 return JVector2D(this->second - this->first).
getDot(segment.second - segment.first);
195 in >> segment.second;
210 out << segment.first;
211 out << segment.second;
Line segment in two dimensions.
double getDistanceSquared(const JVector2D &point) const
Get squared of distance to point.
bool intersects(const JSegment2D &segment) const
Test whether two line segments intersect.
JVector2D getIntersection(const JSegment2D &segment) const
Get intersection of two line segments.
friend JReader & operator>>(JReader &in, JSegment2D &segment)
Read segment from input.
JSegment2D(const JVector2D &A, const JVector2D &B)
Constructor.
friend JWriter & operator<<(JWriter &out, const JSegment2D &segment)
Write segment to output.
double getLengthSquared() const
Get length squared.
double getLength() const
Get length.
JSegment2D()
Default constructor.
double getDistance(const JVector2D &point) const
Get distance to point.
double getDot(const JSegment2D &segment) const
Get dot product.
Data structure for vector in two dimensions.
JVector2D & mul(const double factor)
Scale vector.
JVector2D & div(const double factor)
Scale vector.
JVector2D & sub(const JVector2D &vector)
Subtract vector.
double getLengthSquared() const
Get length squared.
double getDot(const JVector2D &point) const
Get dot product.
Interface for binary input.
Interface for binary output.
Exception for division by zero.
Auxiliary classes and methods for 2D geometrical objects and operations.
bool getCCW(const T &a, const T &b, const T &c)
Check sequence of three points in X-Y plane.
std::pair< JPosition2D, JPosition2D > JSegment2D_t
Type definition of line segment in two dimensions.
double getPerpDot(const JFirst_t &first, const JSecond_t &second)
Get perpendicular dot product of objects.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).