14 #ifndef BASICTOOL_GEOALGO_H 15 #define BASICTOOL_GEOALGO_H 53 bool back =
false)
const;
57 bool back =
false)
const 128 return SqDist(l1, l2, L1, L2);
145 return SqDist(l1, l2, L1, L2);
158 return _SqDist_(seg1, seg2, c1, c2);
165 return SqDist(seg1, seg2, c1, c2);
179 return SqDist(seg, trj, c1, c2);
186 return SqDist(seg, trj, c1, c2);
193 return SqDist(seg, trj, c1, c2);
209 return SqDist(trj1, trj2, c1, c2);
217 const std::vector<geoalgo::Trajectory_t>& trj,
220 int& trackIdx)
const;
222 double SqDist(
const std::vector<geoalgo::Trajectory_t>& trj,
228 return SqDist(seg, trj, c2, c1, trackIdx);
236 return SqDist(seg, trj, c1, c2, trackIdx);
244 return SqDist(seg, trj, c1, c2, trackIdx);
255 return SqDist(hline, trj, c2, c1);
262 return SqDist(hline, trj, c1, c2);
269 return SqDist(hline, trj, c1, c2);
304 const std::vector<geoalgo::Trajectory_t>& trj,
305 int& trackIdx)
const;
307 double SqDist(
const std::vector<geoalgo::Trajectory_t>& trj,
311 return SqDist(pt, trj, trackIdx);
314 double SqDist(
const Point_t& pt,
const std::vector<geoalgo::Trajectory_t>& trj)
const 317 return SqDist(pt, trj, trackIdx);
320 double SqDist(
const std::vector<geoalgo::Trajectory_t>& trj,
const Point_t& pt)
const 323 return SqDist(pt, trj, trackIdx);
327 const std::vector<geoalgo::Trajectory_t>& trj,
328 int& trackIdx)
const;
402 return _SqDist_(hline, seg, L1, L2);
407 return SqDist(hline, seg, L2, L1);
414 return SqDist(hline, seg, L1, L2);
419 return SqDist(hline, seg);
460 bool backwards =
false)
const 469 bool backwards =
false)
const 477 bool backwards =
false)
const 486 bool backwards =
false)
const 494 bool backwards =
false)
const 503 bool backwards =
false)
const 511 bool backwards =
false)
const 520 bool backwards =
false)
const 528 bool backwards =
false)
const 537 bool backwards =
false)
const 539 trj1.front().
compat(trj2.front());
545 bool backwards =
false)
const 554 bool backwards =
false)
const 562 bool backwards =
false)
const 571 bool backwards =
false)
const 579 bool backwards =
false)
const 588 bool backwards =
false)
const 596 bool backwards =
false)
const 605 bool backwards =
false)
const 617 for (
auto& p : pts) {
708 bool backwards)
const;
713 bool backwards)
const;
718 bool backwards)
const;
723 bool backwards)
const;
728 bool backwards)
const;
733 bool backwards)
const;
740 std::vector<Point_t> sosPts)
const;
743 double _Clamp_(
const double n,
const double min,
const double max)
const;
746 inline void _Swap_(
double& tmin,
double& tmax)
const 748 if (tmin > tmax) std::swap(tmin, tmax);
double commonOrigin(const LineSegment_t &seg, const Trajectory_t &trj, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Line Segment. Keep track of origin.
Point_t ClosestPt(const Point_t &pt, const Line_t &line) const
double commonOrigin(const Trajectory_t &trj, const LineSegment_t &seg, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Line Segment. Keep track of origin.
double SqDist(const std::vector< geoalgo::Trajectory_t > &trj, const LineSegment_t &seg, Point_t &c1, Point_t &c2, int &trackIdx) const
LineSegment & vector of Trajectories, keep track of points.
Point_t ClosestPt(const AABox_t &box, const Point_t &pt) const
Point & AABox closest point.
double SqDist(const HalfLine_t &line, const Point_t &pt) const
Point & HalfLine distance.
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
double SqDist(const AABox_t &box, const Point_t &pt)
Point & AABox distance.
double SqDist(const Point_t &pt, const LineSegment_t &line) const
Point & LineSegment_t distance.
Algorithm to compute various geometrical relation among geometrical objects. In particular functions ...
const Point_t & Start() const
Start getter.
Point_t ClosestPt(const Point_t &pt, const std::vector< geoalgo::Trajectory_t > &trj) const
Point_t & Trajectory_t closest point - don't keep track of which track is closest.
Point_t ClosestPt(const std::vector< geoalgo::Trajectory_t > &trj, const Point_t &pt) const
Point_t & Trajectory_t closest point - don't keep track of which track is closest.
double SqDist(const LineSegment_t &line, const Point_t &pt) const
Point & LineSegment distance.
double SqDist(const LineSegment_t &seg, const HalfLine_t &hline, Point_t &L1, Point_t &L2) const
double SqDist(const LineSegment_t &seg1, const LineSegment_t &seg2) const
LineSegment & LineSegment, don't keep track of points.
double _Clamp_(const double n, const double min, const double max) const
Clamp function: checks if value out of bounds.
Point_t ClosestPt(const Point_t &pt, const LineSegment_t &line) const
Point & LineSegment closest point.
double commonOrigin(const HalfLine_t &lin, const Trajectory_t &trj, bool backwards=false) const
Common origin: Trajectory & Half Line. Do not keep track of origin.
double SqDist(const LineSegment_t &seg, const std::vector< geoalgo::Trajectory_t > &trj) const
LineSegment & vector of Trajectories, don't keep track of points.
void compat(const Point_t &obj) const
Dimensionality check function w/ Trajectory.
Class def header for a class HalfLine.
void _Swap_(double &tmin, double &tmax) const
Swap two points if min & max are inverted.
Point_t ClosestPt(const Point_t &pt, const HalfLine_t &line) const
Point & HalfLine closest point.
double SqDist(const HalfLine_t &l1, const HalfLine_t &l2, Point_t &L1, Point_t &L2) const
Point_t _ClosestPt_(const LineSegment_t &line, const Point_t &pt) const
double SqDist(const Trajectory_t &trj, const HalfLine_t &hline) const
HalfLine & Trajectory, don't keep track of points.
double SqDist(const Line_t &line, const Point_t &pt) const
Representation of a simple 3D line segment Defines a finite 3D straight line by having the start and ...
double SqDist(const LineSegment_t &seg1, const LineSegment_t &seg2, Point_t &c1, Point_t &c2) const
LineSegment_t & LineSegment_t distance - keep track of points.
double SqDist(const Trajectory_t &trj, const LineSegment_t &seg, Point_t &c1, Point_t &c2) const
LineSegment & Trajectory, keep track of points.
Representation of a 3D rectangular box which sides are aligned w/ coordinate axis. A representation of an Axis-Aligned-Boundary-Box, a simple & popular representation of 3D boundary box for collision detection. The concept was taken from the reference, Real-Time-Collision-Detection (RTCD), and in particular Ch. 4.2 (page 77): .
double commonOrigin(const HalfLine_t &lin, const LineSegment_t &seg, Point_t &origin, bool backwards=false) const
Common origin: Line Segment & Line Segment. Keep track of origin.
double SqDist(const Point_t &pt, const std::vector< geoalgo::Trajectory_t > &trj) const
Point_t & Trajectory_t distance - don't keep track.
Class def header for a class Line.
void compat(const Vector &obj) const
Dimensional check for a compatibility.
double _SqDist_(const HalfLine_t &line, const Point_t &pt) const
Point & HalfLine distance w/o dimensionality check.
double commonOrigin(const Trajectory_t &trj, const HalfLine_t &lin, bool backwards=false) const
Common origin: Trajectory & Half Line. Do not keep track of origin.
double commonOrigin(const LineSegment_t &seg, const HalfLine_t &lin, bool backwards=false) const
Common origin: Line Segment & Half Line. Do not keep track of origin.
double SqDist(const Line_t &l1, const Line_t &l2) const
double SqDist(const HalfLine_t &hline, const Trajectory_t &trj) const
HalfLine & Trajectory, don't keep track of points.
const Point_t & Min() const
Minimum point getter.
Class def header for a class AABox.
Sphere_t boundingSphere(const std::vector< Point_t > &pts) const
Point_t _ClosestPt_(const Point_t &pt, const Line_t &line) const
Point_t ClosestPt(const HalfLine_t &line, const Point_t &pt) const
Point & HalfLine closest point.
double SqDist(const Point_t &pt, const AABox_t &box) const
Point & AABox distance.
Point_t ClosestPt(const Trajectory_t &trj, const Point_t &pt) const
Point_t & Trajectory_t closest point.
double commonOrigin(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line Segment & Line Segment. Keep track of origin.
double SqDist(const std::vector< geoalgo::Trajectory_t > &trj, const Point_t &pt, int &trackIdx) const
Point_t & Trajectory_t distance - keep track of which track.
Class def header for a class Point and Vector.
double commonOrigin(const HalfLine_t &lin, const Trajectory_t &trj, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Half Line. Keep track of origin.
double commonOrigin(const LineSegment_t &seg, const Trajectory_t &trj, bool backwards=false) const
Common origin: Trajectory & Line Segment. Do not keep track of origin.
double SqDist(const Trajectory_t &trj, const LineSegment_t &seg) const
LineSegment & Trajectory, don't keep track of points.
Point_t ClosestPt(const std::vector< geoalgo::Trajectory_t > &trj, const Point_t &pt, int &trackIdx) const
Point_t & Trajectory_t closest point - keep track of which track is closest.
const Point_t & Pt1() const
Start getter.
const Point_t & End() const
End getter.
double commonOrigin(const Trajectory_t &trj1, const Trajectory_t &trj2, bool backwards=false) const
Common origin: Trajectory & Trajectory. Do not keep track of origin.
double SqDist(const Trajectory_t &trj, const Point_t &pt) const
Point_t & Trajectory_t distance.
Class def header for a class HalfLine.
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
std::vector< Point_t > Intersection(const HalfLine_t &line, const AABox_t &box, bool back=false) const
Intersection between a HalfLine and an AABox.
Representation of a 3D infinite line. Defines an infinite 3D line by having 2 points which completely...
Point_t ClosestPt(const Point_t &pt, const AABox_t &box) const
Point & AABox closest point.
Point_t ClosestPt(const Point_t &pt, const Trajectory_t &trj) const
Point_t & Trajectory_t closest point.
Sphere_t _WelzlSphere_(const std::vector< Point_t > &pts, int numPts, std::vector< Point_t > sosPts) const
double commonOrigin(const HalfLine_t &lin1, const HalfLine_t &lin2, Point_t &origin, bool backwards=false) const
Common origin: Half Line & Half Line. Keep track of origin.
double SqDist(const HalfLine_t &hline, const LineSegment_t &seg, Point_t &L1, Point_t &L2) const
double SqDist(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
double SqDist(const Point_t &pt, const Line_t &line) const
const Point_t & Start() const
Start getter.
Sphere_t _boundingSphere_(const std::vector< Point_t > &pts) const
double commonOrigin(const Trajectory_t &trj, const LineSegment_t &seg, bool backwards=false) const
Common origin: Trajectory & Line Segment. Do not keep track of origin.
double _SqDist_(const Point_t &pt, const LineSegment_t &line) const
Point & LineSegment distance w/o dimensionality check.
Point_t ClosestPt(const Trajectory_t &trj, const Point_t &pt, int &idx) const
Point_t & Trajectory_t closest point. Keep track of index of segment.
double _SqDist_(const AABox_t &box, const Point_t &pt) const
Point & AABox distance w/o dimensionality check.
double SqDist(const LineSegment_t &seg, const Trajectory_t &trj) const
LineSegment & Trajectory, don't keep track of points.
Point_t ClosestPt(const LineSegment_t &line, const Point_t &pt) const
Point & LineSegment closest point.
Representation of a 3D semi-infinite line. Defines a semi-infinite 3D line by having a start point (P...
Sphere_t _RemainingPoints_(std::vector< Point_t > &remaining, const Sphere_t &thisSphere) const
double commonOrigin(const LineSegment_t &seg1, const LineSegment_t &seg2, bool backwards=false) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
std::vector< Point_t > Intersection(const LineSegment_t &l, const AABox_t &box) const
Intersection between LineSegment and an AABox.
Point_t _ClosestPt_(const HalfLine_t &line, const Point_t &pt) const
double commonOrigin(const LineSegment_t &seg1, const LineSegment_t &seg2, Point_t &origin, bool backwards=false) const
Common origin: Line Segment & Line Segment. Keep track of origin.
double SqDist(const LineSegment_t &seg, const HalfLine_t &hline) const
Class def header for a class Trajectory.
Class def header for a class LineSegment.
double SqDist(const std::vector< geoalgo::Trajectory_t > &trj, const LineSegment_t &seg) const
LineSegment & vector of Trajectories, don't keep track of points.
void compat(const Point_t &p, const double r=0) const
3D point compatibility check
double _SqDist_(const Point_t &pt, const Line_t &line) const
double SqDist(const HalfLine_t &l1, const HalfLine_t &l2) const
LineSegment_t BoxOverlap(const AABox_t &box, const HalfLine_t &line) const
LineSegment sub-segment of HalfLine inside an AABox.
double SqDist(const std::vector< geoalgo::Trajectory_t > &trj, const Point_t &pt) const
Point_t & Trajectory_t distance - don't keep track.
double SqDist(const Trajectory_t &trj1, const Trajectory_t &trj2) const
Trajectory & Trajectory, don't keep track of points.
LineSegment_t BoxOverlap(const HalfLine_t &line, const AABox_t &box) const
LineSegment sub-segment of HalfLine inside an AABox.
double commonOrigin(const LineSegment_t &seg, const HalfLine_t &lin, Point_t &origin, bool backwards=false) const
Common origin: Line Segment & Line Segment. Keep track of origin.
Point_t _ClosestPt_(const AABox_t &box, const Point_t &pt) const
Point & AABox closest point w/o dimensionality check.
double SqDist(const Point_t &pt, const HalfLine_t &line) const
Point & HalfLine distance.
double commonOrigin(const HalfLine_t &lin, const LineSegment_t &seg, bool backwards=false) const
Common origin: Line Segment & Half Line. Do not keep track of origin.
double _SqDist_(const LineSegment_t &line, const Point_t &pt) const
Point & LineSegment distance w/o dimensionality check.
std::vector< Point_t > Intersection(const AABox_t &box, const HalfLine_t &line, bool back=false) const
Intersection between a HalfLine and an AABox.
double SqDist(const Trajectory_t &trj, const HalfLine_t &hline, Point_t &c1, Point_t &c2) const
HalfLine & Trajectory, keep track of points.
double SqDist(const HalfLine_t &hline, const LineSegment_t &seg) const
double commonOrigin(const Trajectory_t &trj, const HalfLine_t &lin, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Half Line. Keep track of origin.
std::vector< Point_t > Intersection(const Trajectory_t &trj, const AABox_t &box) const
Intersection between Trajectory and an AABox.
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
double commonOrigin(const Trajectory_t &trj1, const Trajectory_t &trj2, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Trajectory. Keep track of origin.
constexpr Point origin()
Returns a origin position with a point of the specified type.
Trajectory_t BoxOverlap(const Trajectory_t &trj, const AABox_t &box) const
Get Trajectory inside box given some input trajectory -> now assumes trajectory cannot exit and re-en...
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
double commonOrigin(const HalfLine_t &lin1, const HalfLine_t &lin2, bool backwards=false) const
Common origin: Half Line & Half Line. Do not keep track of origin.