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(
Point_t const& 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,
Point_t const& 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_(
double const n,
double const min,
double const max)
const;
746 inline void _Swap_(
double& tmin,
double& tmax)
const 748 if (tmin > tmax) std::swap(tmin, tmax);
Point_t const & Start() const
Start getter.
double SqDist(Point_t const &pt, HalfLine_t const &line) const
Point & HalfLine distance.
double commonOrigin(Trajectory_t const &trj, HalfLine_t const &lin, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Half Line. Keep track of origin.
double SqDist(LineSegment_t const &seg1, LineSegment_t const &seg2) const
LineSegment & LineSegment, don't keep track of points.
void compat(Vector const &obj) const
Dimensional check for a compatibility.
double SqDist(const std::vector< geoalgo::Trajectory_t > &trj, Point_t const &pt) const
Point_t & Trajectory_t distance - don't keep track.
Algorithm to compute various geometrical relation among geometrical objects. In particular functions ...
double commonOrigin(Trajectory_t const &trj1, Trajectory_t const &trj2, bool backwards=false) const
Common origin: Trajectory & Trajectory. Do not keep track of origin.
double commonOrigin(LineSegment_t const &seg1, LineSegment_t const &seg2, bool backwards=false) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Point_t _ClosestPt_(Point_t const &pt, Line_t const &line) const
double _Clamp_(double const n, double const min, double const max) const
Clamp function: checks if value out of bounds.
double commonOrigin(HalfLine_t const &lin, Trajectory_t const &trj, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Half Line. Keep track of origin.
Point_t ClosestPt(Point_t const &pt, LineSegment_t const &line) const
Point & LineSegment closest point.
double commonOrigin(Trajectory_t const &trj, HalfLine_t const &lin, bool backwards=false) const
Common origin: Trajectory & Half Line. Do not keep track of origin.
double commonOrigin(LineSegment_t const &seg1, LineSegment_t const &seg2, Point_t &origin, bool backwards=false) const
Common origin: Line Segment & Line Segment. Keep track of origin.
double SqDist(Trajectory_t const &trj, Point_t const &pt) const
Point_t & Trajectory_t distance.
Point_t ClosestPt(HalfLine_t const &line, Point_t const &pt) const
Point & HalfLine closest point.
double SqDist(Trajectory_t const &trj, LineSegment_t const &seg, Point_t &c1, Point_t &c2) const
LineSegment & Trajectory, keep track of points.
Trajectory_t BoxOverlap(Trajectory_t const &trj, AABox_t const &box) const
Get Trajectory inside box given some input trajectory -> now assumes trajectory cannot exit and re-en...
Class def header for a class HalfLine.
double SqDist(Point_t const &pt, const std::vector< geoalgo::Trajectory_t > &trj) const
Point_t & Trajectory_t distance - don't keep track.
Point_t ClosestPt(Point_t const &pt, AABox_t const &box) const
Point & AABox closest point.
void _Swap_(double &tmin, double &tmax) const
Swap two points if min & max are inverted.
double commonOrigin(HalfLine_t const &lin, LineSegment_t const &seg, bool backwards=false) const
Common origin: Line Segment & Half Line. Do not keep track of origin.
double SqDist(Line_t const &line, Point_t const &pt) const
Point_t _ClosestPt_(HalfLine_t const &line, Point_t const &pt) const
double SqDist(LineSegment_t const &seg, HalfLine_t const &hline, Point_t &L1, Point_t &L2) const
double SqDist(HalfLine_t const &l1, HalfLine_t const &l2, Point_t &L1, Point_t &L2) const
Representation of a simple 3D line segment Defines a finite 3D straight line by having the start and ...
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 SqDist(Trajectory_t const &trj1, Trajectory_t const &trj2) const
Trajectory & Trajectory, don't keep track of points.
Class def header for a class Line.
double _SqDist_(Line_t const &l1, Line_t const &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
double SqDist(HalfLine_t const &hline, Trajectory_t const &trj) const
HalfLine & Trajectory, don't keep track of points.
double commonOrigin(Trajectory_t const &trj1, Trajectory_t const &trj2, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Trajectory. Keep track of origin.
double commonOrigin(Line_t const &lin1, Line_t const &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
double SqDist(LineSegment_t const &seg, const std::vector< geoalgo::Trajectory_t > &trj) const
LineSegment & vector of Trajectories, don't keep track of points.
double SqDist(Line_t const &l1, Line_t const &l2, Point_t &L1, Point_t &L2) const
double commonOrigin(LineSegment_t const &seg, HalfLine_t const &lin, bool backwards=false) const
Common origin: Line Segment & Half Line. Do not keep track of origin.
double commonOrigin(HalfLine_t const &lin1, HalfLine_t const &lin2, Point_t &origin, bool backwards=false) const
Common origin: Half Line & Half Line. Keep track of origin.
Point_t ClosestPt(Line_t const &line, Point_t const &pt) const
Class def header for a class AABox.
Sphere_t boundingSphere(const std::vector< Point_t > &pts) const
Point_t ClosestPt(AABox_t const &box, Point_t const &pt) const
Point & AABox closest point.
double commonOrigin(Trajectory_t const &trj, LineSegment_t const &seg, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Line Segment. Keep track of origin.
double commonOrigin(LineSegment_t const &seg, HalfLine_t const &lin, Point_t &origin, bool backwards=false) const
Common origin: Line Segment & Line Segment. Keep track of origin.
double SqDist(Line_t const &l1, Line_t const &l2) const
std::vector< Point_t > Intersection(LineSegment_t const &l, AABox_t const &box) const
Intersection between LineSegment and an AABox.
double SqDist(LineSegment_t const &seg1, LineSegment_t const &seg2, Point_t &c1, Point_t &c2) const
LineSegment_t & LineSegment_t distance - keep track of points.
Point_t _ClosestPt_(Point_t const &pt, LineSegment_t const &line) const
double _SqDist_(HalfLine_t const &line, Point_t const &pt) const
Point & HalfLine distance w/o dimensionality check.
Point_t ClosestPt(Trajectory_t const &trj, Point_t const &pt) const
Point_t & Trajectory_t closest point.
double commonOrigin(HalfLine_t const &lin, Trajectory_t const &trj, bool backwards=false) const
Common origin: Trajectory & Half Line. Do not keep track of origin.
std::vector< Point_t > Intersection(Trajectory_t const &trj, AABox_t const &box) const
Intersection between Trajectory and an AABox.
Point_t ClosestPt(Point_t const &pt, Line_t const &line) const
Class def header for a class Point and Vector.
double commonOrigin(Trajectory_t const &trj, LineSegment_t const &seg, bool backwards=false) const
Common origin: Trajectory & Line Segment. Do not keep track of origin.
Sphere_t _RemainingPoints_(std::vector< Point_t > &remaining, Sphere_t const &thisSphere) const
double commonOrigin(LineSegment_t const &seg, Trajectory_t const &trj, Point_t &origin, bool backwards=false) const
Common origin: Trajectory & Line Segment. Keep track of origin.
Point_t ClosestPt(Point_t const &pt, HalfLine_t const &line) const
Point & HalfLine closest point.
Point_t ClosestPt(Point_t const &pt, const std::vector< geoalgo::Trajectory_t > &trj) const
Point_t & Trajectory_t closest point - don't keep track of which track is closest.
double SqDist(const std::vector< geoalgo::Trajectory_t > &trj, Point_t const &pt, int &trackIdx) const
Point_t & Trajectory_t distance - keep track of which track.
double SqDist(HalfLine_t const &line, Point_t const &pt) const
Point & HalfLine distance.
Point_t ClosestPt(LineSegment_t const &line, Point_t const &pt) const
Point & LineSegment closest point.
Point_t ClosestPt(const std::vector< geoalgo::Trajectory_t > &trj, Point_t const &pt) const
Point_t & Trajectory_t closest point - don't keep track of which track is closest.
Class def header for a class HalfLine.
double SqDist(Trajectory_t const &trj, HalfLine_t const &hline) const
HalfLine & Trajectory, don't keep track of points.
double SqDist(Trajectory_t const &trj, LineSegment_t const &seg) const
LineSegment & Trajectory, don't keep track of points.
Representation of a 3D infinite line. Defines an infinite 3D line by having 2 points which completely...
double _SqDist_(AABox_t const &box, Point_t const &pt) const
Point & AABox distance w/o dimensionality check.
double _SqDist_(Point_t const &pt, Line_t const &line) const
double SqDist(AABox_t const &box, Point_t const &pt)
Point & AABox distance.
Sphere_t _WelzlSphere_(const std::vector< Point_t > &pts, int numPts, std::vector< Point_t > sosPts) const
void compat(Point_t const &obj) const
Dimensionality check function w/ Trajectory.
Point_t ClosestPt(Trajectory_t const &trj, Point_t const &pt, int &idx) const
Point_t & Trajectory_t closest point. Keep track of index of segment.
double SqDist(Point_t const &pt, AABox_t const &box) const
Point & AABox distance.
double SqDist(const std::vector< geoalgo::Trajectory_t > &trj, LineSegment_t const &seg) const
LineSegment & vector of Trajectories, don't keep track of points.
Point_t _ClosestPt_(AABox_t const &box, Point_t const &pt) const
Point & AABox closest point w/o dimensionality check.
Sphere_t _boundingSphere_(const std::vector< Point_t > &pts) const
double _SqDist_(Point_t const &pt, LineSegment_t const &line) const
Point & LineSegment distance w/o dimensionality check.
double SqDist(Point_t const &pt, LineSegment_t const &line) const
Point & LineSegment_t distance.
double SqDist(LineSegment_t const &seg, Trajectory_t const &trj) const
LineSegment & Trajectory, don't keep track of points.
double commonOrigin(HalfLine_t const &lin, LineSegment_t const &seg, Point_t &origin, bool backwards=false) const
Common origin: Line Segment & Line Segment. Keep track of origin.
double commonOrigin(Line_t const &lin1, Line_t const &lin2, Point_t &origin) const
Common origin: Line Segment & Line Segment. Keep track of origin.
void compat(Point_t const &p, double const r=0) const
3D point compatibility check
Point_t _ClosestPt_(LineSegment_t const &line, Point_t const &pt) const
double SqDist(HalfLine_t const &l1, HalfLine_t const &l2) const
double _SqDist_(LineSegment_t const &line, Point_t const &pt) const
Point & LineSegment distance w/o dimensionality check.
Representation of a 3D semi-infinite line. Defines a semi-infinite 3D line by having a start point (P...
Point_t const & Start() const
Start getter.
Point_t ClosestPt(const std::vector< geoalgo::Trajectory_t > &trj, Point_t const &pt, int &trackIdx) const
Point_t & Trajectory_t closest point - keep track of which track is closest.
Class def header for a class Trajectory.
double commonOrigin(HalfLine_t const &lin1, HalfLine_t const &lin2, bool backwards=false) const
Common origin: Half Line & Half Line. Do not keep track of origin.
Class def header for a class LineSegment.
double SqDist(HalfLine_t const &hline, LineSegment_t const &seg) const
Point_t const & End() const
End getter.
std::vector< Point_t > Intersection(AABox_t const &box, HalfLine_t const &line, bool back=false) const
Intersection between a HalfLine and an AABox.
double SqDist(Point_t const &pt, Line_t const &line) const
Point_t ClosestPt(Point_t const &pt, Trajectory_t const &trj) const
Point_t & Trajectory_t closest point.
Point_t const & Pt1() const
Start getter.
double commonOrigin(LineSegment_t const &seg, Trajectory_t const &trj, bool backwards=false) const
Common origin: Trajectory & Line Segment. Do not keep track of origin.
LineSegment_t BoxOverlap(AABox_t const &box, HalfLine_t const &line) const
LineSegment sub-segment of HalfLine inside an AABox.
double SqDist(LineSegment_t const &seg, HalfLine_t const &hline) const
double SqDist(HalfLine_t const &hline, LineSegment_t const &seg, Point_t &L1, Point_t &L2) const
double SqDist(LineSegment_t const &line, Point_t const &pt) const
Point & LineSegment distance.
Point_t const & Min() const
Minimum point getter.
double SqDist(Trajectory_t const &trj, HalfLine_t const &hline, Point_t &c1, Point_t &c2) const
HalfLine & Trajectory, keep track of points.
constexpr Point origin()
Returns a origin position with a point of the specified type.
double _commonOrigin_(Line_t const &lin1, Line_t const &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
LineSegment_t BoxOverlap(HalfLine_t const &line, AABox_t const &box) const
LineSegment sub-segment of HalfLine inside an AABox.
std::vector< Point_t > Intersection(HalfLine_t const &line, AABox_t const &box, bool back=false) const
Intersection between a HalfLine and an AABox.
double SqDist(const std::vector< geoalgo::Trajectory_t > &trj, LineSegment_t const &seg, Point_t &c1, Point_t &c2, int &trackIdx) const
LineSegment & vector of Trajectories, keep track of points.