14 #ifndef BASICTOOL_GEOALGO_H 15 #define BASICTOOL_GEOALGO_H 91 {
return SqDist(line,pt); }
140 {
return SqDist(seg, trj, c1, c2); }
166 {
return SqDist(seg, trj, c2, c1, trackIdx); }
182 {
return SqDist(hline, trj, c2, c1); }
198 {
return SqDist(pt,trj); }
201 {
int idx=0;
return ClosestPt(pt,trj,idx); }
204 {
int idx=0;
return ClosestPt(pt,trj,idx); }
216 double SqDist(
const Point_t& pt,
const std::vector<geoalgo::Trajectory_t> &trj,
int& trackIdx)
const;
218 double SqDist(
const std::vector<geoalgo::Trajectory_t> &trj,
const Point_t& pt,
int& trackIdx)
const 219 {
return SqDist(pt,trj, trackIdx); }
221 double SqDist(
const Point_t& pt,
const std::vector<geoalgo::Trajectory_t> &trj)
const 222 {
int trackIdx;
return SqDist(pt, trj, trackIdx); }
224 double SqDist(
const std::vector<geoalgo::Trajectory_t> &trj,
const Point_t& pt)
const 225 {
int trackIdx;
return SqDist(pt, trj, trackIdx); }
233 {
int trackIdx;
return ClosestPt(pt, trj, trackIdx); }
236 {
int trackIdx;
return ClosestPt(pt, trj, trackIdx); }
247 {
return SqDist(pt,line); }
263 {
return SqDist(pt,line); }
280 {
return SqDist(hline,seg, L2, L1); }
286 {
return SqDist(hline,seg); }
296 {
return SqDist(pt,box); }
460 Sphere_t _WelzlSphere_(
const std::vector<Point_t>& pts,
int numPts, std::vector<Point_t> sosPts)
const;
463 double _Clamp_(
const double n,
const double min,
const double max)
const;
466 inline void _Swap_(
double& tmin,
double& tmax)
const 467 {
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.
void swap(Handle< T > &a, Handle< T > &b)
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
static int max(int a, int b)
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.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
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.
void line(double t, double *p, double &x, double &y, double &z)
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.