LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
geoalgo::GeoAlgo Class Reference

Algorithm to compute various geometrical relation among geometrical objects. In particular functions to inspect following relations are implemented:
0) Distance between geometrical objects
1) Closest point of approach
2) Intersection points
3) Containment/Overlap of objects
4) Common Origin functions
5) Bounding Sphere functions
. More...

#include "GeoAlgo.h"

Public Member Functions

 GeoAlgo ()
 Default constructor. More...
 
virtual ~GeoAlgo ()
 Default destructor. More...
 
std::vector< Point_tIntersection (const AABox_t &box, const HalfLine_t &line, bool back=false) const
 Intersection between a HalfLine and an AABox. More...
 
std::vector< Point_tIntersection (const HalfLine_t &line, const AABox_t &box, bool back=false) const
 Intersection between a HalfLine and an AABox. More...
 
std::vector< Point_tIntersection (const AABox_t &box, const LineSegment_t &l) const
 Intersection between LineSegment and an AABox. More...
 
std::vector< Point_tIntersection (const LineSegment_t &l, const AABox_t &box) const
 Intersection between LineSegment and an AABox. More...
 
std::vector< Point_tIntersection (const AABox_t &box, const Trajectory_t &trj) const
 Intersection between Trajectory and an AABox. More...
 
std::vector< Point_tIntersection (const Trajectory_t &trj, const AABox_t &box) const
 Intersection between Trajectory and an AABox. More...
 
LineSegment_t BoxOverlap (const AABox_t &box, const HalfLine_t &line) const
 LineSegment sub-segment of HalfLine inside an AABox. More...
 
LineSegment_t BoxOverlap (const HalfLine_t &line, const AABox_t &box) const
 LineSegment sub-segment of HalfLine inside an AABox. More...
 
Trajectory_t BoxOverlap (const AABox_t &box, const Trajectory_t &trj) const
 Get Trajectory inside box given some input trajectory -> now assumes trajectory cannot exit and re-enter box. More...
 
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-enter box. More...
 
double SqDist (const Line_t &line, const Point_t &pt) const
 
double SqDist (const Point_t &pt, const Line_t &line) const
 
Point_t ClosestPt (const Line_t &line, const Point_t &pt) const
 
Point_t ClosestPt (const Point_t &pt, const Line_t &line) const
 
double SqDist (const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
 
double SqDist (const Line_t &l1, const Line_t &l2) const
 
double SqDist (const HalfLine_t &l1, const HalfLine_t &l2, Point_t &L1, Point_t &L2) const
 
double SqDist (const HalfLine_t &l1, const HalfLine_t &l2) const
 
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. More...
 
double SqDist (const LineSegment_t &seg1, const LineSegment_t &seg2) const
 LineSegment & LineSegment, don't keep track of points. More...
 
double SqDist (const LineSegment_t &seg, const Trajectory_t &trj, Point_t &c1, Point_t &c2) const
 LineSegment & Trajectory, keep track of points. More...
 
double SqDist (const Trajectory_t &trj, const LineSegment_t &seg, Point_t &c1, Point_t &c2) const
 LineSegment & Trajectory, keep track of points. More...
 
double SqDist (const Trajectory_t &trj, const LineSegment_t &seg) const
 LineSegment & Trajectory, don't keep track of points. More...
 
double SqDist (const LineSegment_t &seg, const Trajectory_t &trj) const
 LineSegment & Trajectory, don't keep track of points. More...
 
double SqDist (const Trajectory_t &trj1, const Trajectory_t &trj2, Point_t &c1, Point_t &c2) const
 Trajectory & Trajectory, keep track of points. More...
 
double SqDist (const Trajectory_t &trj1, const Trajectory_t &trj2) const
 Trajectory & Trajectory, don't keep track of points. More...
 
double SqDist (const LineSegment_t &seg, const std::vector< geoalgo::Trajectory_t > &trj, Point_t &c1, Point_t &c2, int &trackIdx) const
 LineSegment & vector of Trajectories, keep track of points. More...
 
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. More...
 
double SqDist (const std::vector< geoalgo::Trajectory_t > &trj, const LineSegment_t &seg) const
 LineSegment & vector of Trajectories, don't keep track of points. More...
 
double SqDist (const LineSegment_t &seg, const std::vector< geoalgo::Trajectory_t > &trj) const
 LineSegment & vector of Trajectories, don't keep track of points. More...
 
double SqDist (const HalfLine_t &hline, const Trajectory_t &trj, Point_t &c1, Point_t &c2) const
 HalfLine & Trajectory, keep track of points. More...
 
double SqDist (const Trajectory_t &trj, const HalfLine_t &hline, Point_t &c1, Point_t &c2) const
 HalfLine & Trajectory, keep track of points. More...
 
double SqDist (const Trajectory_t &trj, const HalfLine_t &hline) const
 HalfLine & Trajectory, don't keep track of points. More...
 
double SqDist (const HalfLine_t &hline, const Trajectory_t &trj) const
 HalfLine & Trajectory, don't keep track of points. More...
 
double SqDist (const Point_t &pt, const Trajectory_t &trj) const
 Point_t & Trajectory_t distance. More...
 
double SqDist (const Trajectory_t &trj, const Point_t &pt) const
 Point_t & Trajectory_t distance. More...
 
Point_t ClosestPt (const Point_t &pt, const Trajectory_t &trj) const
 Point_t & Trajectory_t closest point. More...
 
Point_t ClosestPt (const Trajectory_t &trj, const Point_t &pt) const
 Point_t & Trajectory_t closest point. More...
 
Point_t ClosestPt (const Point_t &pt, const Trajectory_t &trj, int &idx) const
 Point_t & Trajectory_t closest point. Keep track of index of segment. More...
 
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. More...
 
double SqDist (const Point_t &pt, const std::vector< geoalgo::Trajectory_t > &trj, int &trackIdx) const
 Point_t & Trajectory_t distance - keep track of which track. More...
 
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. More...
 
double SqDist (const Point_t &pt, const std::vector< geoalgo::Trajectory_t > &trj) const
 Point_t & Trajectory_t distance - don't keep track. More...
 
double SqDist (const std::vector< geoalgo::Trajectory_t > &trj, const Point_t &pt) const
 Point_t & Trajectory_t distance - don't keep track. More...
 
Point_t ClosestPt (const Point_t &pt, const std::vector< geoalgo::Trajectory_t > &trj, int &trackIdx) const
 Point_t & Trajectory_t closest point - keep track of which track is closest. More...
 
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. More...
 
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. More...
 
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. More...
 
double SqDist (const Point_t &pt, const LineSegment_t &line) const
 Point & LineSegment_t distance. More...
 
double SqDist (const LineSegment_t &line, const Point_t &pt) const
 Point & LineSegment distance. More...
 
Point_t ClosestPt (const Point_t &pt, const LineSegment_t &line) const
 Point & LineSegment closest point. More...
 
Point_t ClosestPt (const LineSegment_t &line, const Point_t &pt) const
 Point & LineSegment closest point. More...
 
double SqDist (const Point_t &pt, const HalfLine_t &line) const
 Point & HalfLine distance. More...
 
double SqDist (const HalfLine_t &line, const Point_t &pt) const
 Point & HalfLine distance. More...
 
Point_t ClosestPt (const Point_t &pt, const HalfLine_t &line) const
 Point & HalfLine closest point. More...
 
Point_t ClosestPt (const HalfLine_t &line, const Point_t &pt) const
 Point & HalfLine closest point. More...
 
double SqDist (const HalfLine_t &hline, const LineSegment_t &seg, Point_t &L1, Point_t &L2) const
 
double SqDist (const LineSegment_t &seg, const HalfLine_t &hline, Point_t &L1, Point_t &L2) const
 
double SqDist (const HalfLine_t &hline, const LineSegment_t &seg) const
 
double SqDist (const LineSegment_t &seg, const HalfLine_t &hline) const
 
double SqDist (const Point_t &pt, const AABox_t &box) const
 Point & AABox distance. More...
 
double SqDist (const AABox_t &box, const Point_t &pt)
 Point & AABox distance. More...
 
Point_t ClosestPt (const Point_t &pt, const AABox_t &box) const
 Point & AABox closest point. More...
 
Point_t ClosestPt (const AABox_t &box, const Point_t &pt) const
 Point & AABox closest point. More...
 
double commonOrigin (const Line_t &lin1, const Line_t &lin2) const
 Common origin: Line Segment & Line Segment. Do not keep track of origin. More...
 
double commonOrigin (const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
 Common origin: Line Segment & Line Segment. Keep track of origin. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
double commonOrigin (const Trajectory_t &trj1, const Trajectory_t &trj2, bool backwards=false) const
 Common origin: Trajectory & Trajectory. Do not keep track of origin. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Sphere_t boundingSphere (const std::vector< Point_t > &pts) const
 

Protected Member Functions

double _SqDist_ (const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
 Line & Line distance w/o dimensionality check. More...
 
double _SqDist_ (const HalfLine_t &l1, const HalfLine_t &l2, Point_t &L1, Point_t &L2) const
 HalfLine & HalfLine distance w/o dimensionality check. More...
 
double _SqDist_ (const Point_t &pt, const LineSegment_t &line) const
 Point & LineSegment distance w/o dimensionality check. More...
 
double _SqDist_ (const Point_t &pt, const Point_t &line_s, const Point_t &line_e) const
 Point & LineSegment distance w/o dimensionality check. More...
 
double _SqDist_ (const LineSegment_t &line, const Point_t &pt) const
 Point & LineSegment distance w/o dimensionality check. More...
 
double _SqDist_ (const HalfLine_t &hline, const LineSegment_t &seg, Point_t &L1, Point_t &L2) const
 HalfLine & LineSegment distance w/o dimensionality check. More...
 
double _SqDist_ (const LineSegment_t &seg1, const LineSegment_t &seg2, Point_t &c1, Point_t &c2) const
 LineSegment & LineSegment distance w/o dimensionality check. More...
 
Point_t _ClosestPt_ (const Point_t &pt, const LineSegment_t &line) const
 
Point_t _ClosestPt_ (const LineSegment_t &line, const Point_t &pt) const
 
double _SqDist_ (const Point_t &pt, const HalfLine_t &line) const
 Point & HalfLine distance w/o dimensionality check. More...
 
double _SqDist_ (const HalfLine_t &line, const Point_t &pt) const
 Point & HalfLine distance w/o dimensionality check. More...
 
Point_t _ClosestPt_ (const Point_t &pt, const HalfLine_t &line) const
 
Point_t _ClosestPt_ (const HalfLine_t &line, const Point_t &pt) const
 
Point_t _ClosestPt_ (const Line_t &line, const Point_t &pt) const
 
Point_t _ClosestPt_ (const Point_t &pt, const Line_t &line) const
 
double _SqDist_ (const Line_t &line, const Point_t &pt) const
 
double _SqDist_ (const Point_t &pt, const Line_t &line) const
 
double _SqDist_ (const Point_t &pt, const AABox_t &box) const
 Point & AABox distance w/o dimensionality check. More...
 
double _SqDist_ (const AABox_t &box, const Point_t &pt) const
 Point & AABox distance w/o dimensionality check. More...
 
Point_t _ClosestPt_ (const Point_t &pt, const AABox_t &box) const
 Point & AABox closest point w/o dimensionality check. More...
 
Point_t _ClosestPt_ (const AABox_t &box, const Point_t &pt) const
 Point & AABox closest point w/o dimensionality check. More...
 
double _commonOrigin_ (const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
 Common origin: Line & Line. Keep track of origin. More...
 
double _commonOrigin_ (const HalfLine_t &lin1, const HalfLine_t &lin2, Point_t &origin, bool backwards) const
 Common origin: Half Line & Half Line. Keep track of origin. More...
 
double _commonOrigin_ (const HalfLine_t &lin, const LineSegment_t &seg, Point_t &origin, bool backwards) const
 Common origin: Line Segment & Half Line. Keep track of origin. More...
 
double _commonOrigin_ (const LineSegment_t &seg1, const LineSegment_t &seg2, Point_t &origin, bool backwards) const
 Common origin: Line Segment & Line Segment. Keep track of origin. More...
 
double _commonOrigin_ (const Trajectory_t &trj1, const Trajectory_t &trj2, Point_t &origin, bool backwards) const
 Common origin: Trajectory & Trajectory. Keep track of origin. More...
 
double _commonOrigin_ (const Trajectory_t &trj, const LineSegment_t &seg, Point_t &origin, bool backwards) const
 Common origin: Trajectory & Line Segment. Keep track of origin. More...
 
double _commonOrigin_ (const Trajectory_t &trj, const HalfLine_t &lin, Point_t &origin, bool backwards) const
 Common origin: Trajectory & Half Line. Keep track of origin. More...
 
Sphere_t _boundingSphere_ (const std::vector< Point_t > &pts) const
 
Sphere_t _RemainingPoints_ (std::vector< Point_t > &remaining, const Sphere_t &thisSphere) const
 
Sphere_t _WelzlSphere_ (const std::vector< Point_t > &pts, int numPts, std::vector< Point_t > sosPts) const
 
double _Clamp_ (const double n, const double min, const double max) const
 Clamp function: checks if value out of bounds. More...
 
void _Swap_ (double &tmin, double &tmax) const
 Swap two points if min & max are inverted. More...
 

Detailed Description

Algorithm to compute various geometrical relation among geometrical objects. In particular functions to inspect following relations are implemented:
0) Distance between geometrical objects
1) Closest point of approach
2) Intersection points
3) Containment/Overlap of objects
4) Common Origin functions
5) Bounding Sphere functions
.

Most functions are taken from the reference Real-Time-Collision-Detection (RTCD): Ref: http://realtimecollisiondetection.net

Definition at line 42 of file GeoAlgo.h.

Constructor & Destructor Documentation

geoalgo::GeoAlgo::GeoAlgo ( )
inline

Default constructor.

Definition at line 47 of file GeoAlgo.h.

47 {}
virtual geoalgo::GeoAlgo::~GeoAlgo ( )
inlinevirtual

Default destructor.

Definition at line 50 of file GeoAlgo.h.

References Intersection().

50 {}

Member Function Documentation

Sphere_t geoalgo::GeoAlgo::_boundingSphere_ ( const std::vector< Point_t > &  pts) const
protected

Bounding Sphere problem Real-Time Collision Analysis 4.3.5 (Pg. 100) - WelzlSphere

Definition at line 1014 of file GeoAlgo.cxx.

References _RemainingPoints_().

Referenced by _ClosestPt_(), and boundingSphere().

1015  {
1016 
1017  // Remove any duplicate points
1018  std::vector<Point_t> copyPts = {pts[0]};
1019  for(size_t p1=0; p1 < pts.size(); p1++){
1020  // if an identical point does not already exist in copyPts -> then add
1021  bool found = false;
1022  for (size_t p2 =0; p2 < copyPts.size(); p2++)
1023  if (pts[p1] == copyPts[p2]) { found = true; break; }
1024  if (!found)
1025  copyPts.push_back(pts[p1]);
1026  }
1027 
1028  // if 4 or less points call appropriate constructor
1029  if (copyPts.size() < 5)
1030  return Sphere_t(copyPts);
1031 
1032  size_t npoints = copyPts.size();
1033  std::vector<Point_t> points4 = {copyPts[npoints-1],copyPts[npoints-2],copyPts[npoints-3],copyPts[npoints-4]};
1034  copyPts.pop_back();
1035  copyPts.pop_back();
1036  copyPts.pop_back();
1037  copyPts.pop_back();
1038  Sphere_t tmpSphere = Sphere(points4);
1039  return _RemainingPoints_(copyPts,tmpSphere);
1040 
1041  // too many points to call simple constructor! find minimally bounding sphere
1042  // compute sphere for first 4 points
1043  //Sphere_t tmpSphere(copyPts[0],copyPts[1],copyPts[2],copyPts[3]);
1044  //std::vector<Point_t> sosPoints;// = {pts[0]};
1045  //sosPoints.clear();
1046  //return _WelzlSphere_(copyPts,copyPts.size(),sosPoints);
1047  }
Sphere_t _RemainingPoints_(std::vector< Point_t > &remaining, const Sphere_t &thisSphere) const
Definition: GeoAlgo.cxx:1049
Sphere Sphere_t
Definition: GeoSphere.h:119
double geoalgo::GeoAlgo::_Clamp_ ( const double  n,
const double  min,
const double  max 
) const
protected

Clamp function: checks if value out of bounds.

Definition at line 844 of file GeoAlgo.cxx.

References max, min, and n.

Referenced by _ClosestPt_(), and _SqDist_().

845  {
846  if (n < min) { return min; }
847  if (n > max) { return max; }
848  return n;
849  }
Int_t max
Definition: plot.C:27
Int_t min
Definition: plot.C:26
Char_t n[5]
Point_t geoalgo::GeoAlgo::_ClosestPt_ ( const Point_t pt,
const LineSegment_t line 
) const
protected

Definition at line 387 of file GeoAlgo.cxx.

References geoalgo::LineSegment::Dir(), geoalgo::LineSegment::End(), geoalgo::Vector::SqLength(), and geoalgo::LineSegment::Start().

Referenced by _ClosestPt_(), _SqDist_(), and ClosestPt().

388  {
389 
390  auto const& ab = line.Dir();
391  // Project pt on line (ab), but deferring divide by ab * ab
392  auto t = ((pt - line.Start()) * ab);
393  // pt projects outside line, on the start side; clamp to start
394  if( t <= 0. ) return line.Start();
395  else {
396  auto denom = ab.SqLength();
397  // pt projects outside line, on the end side; clamp to end
398  if( t>= denom ) return line.End();
399  // pt projects inside the line. must deferred divide now
400  else return (line.Start() + ab * (t/denom));
401  }
402  }
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::_ClosestPt_ ( const LineSegment_t line,
const Point_t pt 
) const
inlineprotected

Definition at line 409 of file GeoAlgo.h.

References _ClosestPt_(), and _SqDist_().

410  { return _ClosestPt_(pt,line); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::_ClosestPt_ ( const Point_t pt,
const HalfLine_t line 
) const
protected

Definition at line 419 of file GeoAlgo.cxx.

References geoalgo::HalfLine::Dir(), geoalgo::Vector::Length(), and geoalgo::HalfLine::Start().

420  {
421  auto const& ab = line.Dir();
422  auto t = (pt - line.Start()) * ab;
423  if( t <= 0. ) return line.Start();
424  else {
425  auto denom = ab.Length();
426  return (line.Start() + ab * (t/denom));
427  }
428  }
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::_ClosestPt_ ( const HalfLine_t line,
const Point_t pt 
) const
inlineprotected

Definition at line 420 of file GeoAlgo.h.

References _ClosestPt_().

421  { return _ClosestPt_(pt,line); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::_ClosestPt_ ( const Line_t line,
const Point_t pt 
) const
protected

Definition at line 443 of file GeoAlgo.cxx.

References geoalgo::Vector::Length(), geoalgo::Line::Pt1(), and geoalgo::Line::Pt2().

444  {
445  auto const& ab = line.Pt2()-line.Pt1();
446  auto t = (pt - line.Pt1()) * ab;
447  auto denom = ab.Length();
448  return (line.Pt1() + ab * (t/denom));
449  }
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::_ClosestPt_ ( const Point_t pt,
const Line_t line 
) const
inlineprotected

Definition at line 426 of file GeoAlgo.h.

References _ClosestPt_(), and _SqDist_().

427  { return _ClosestPt_(line,pt); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::_ClosestPt_ ( const Point_t pt,
const AABox_t box 
) const
protected

Point & AABox closest point w/o dimensionality check.

Definition at line 499 of file GeoAlgo.cxx.

References geoalgo::AABox::Max(), geoalgo::AABox::Min(), and pt.

500  {
501  // Result
502  auto res = pt;
503  // For each coordinate axis, if the point coordinate value is outside box,
504  // clamp it to the box, else keep it as is
505  for(size_t i=0; i<pt.size(); ++i) {
506  auto const& v_pt = pt[i];
507  auto const& v_min = box.Min()[i];
508  auto const& v_max = box.Max()[i];
509  res[i] = v_pt;
510  if( v_pt < v_min ) res[i] = v_min;
511  if( v_pt > v_max ) res[i] = v_max;
512  }
513  return res;
514  }
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::_ClosestPt_ ( const AABox_t box,
const Point_t pt 
) const
inlineprotected

Point & AABox closest point w/o dimensionality check.

Definition at line 443 of file GeoAlgo.h.

References _boundingSphere_(), _Clamp_(), _ClosestPt_(), _commonOrigin_(), _RemainingPoints_(), _WelzlSphere_(), max, min, n, and geo::origin().

444  { return _ClosestPt_(pt,box); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
double geoalgo::GeoAlgo::_commonOrigin_ ( const Line_t lin1,
const Line_t lin2,
Point_t origin 
) const
protected

Common origin: Line & Line. Keep track of origin.

Common origin: Half Line & Half Line. Keep track of origin.

Definition at line 853 of file GeoAlgo.cxx.

References geoalgo::Vector::Dot(), geoalgo::Vector::Normalize(), geo::origin(), geoalgo::Line::Pt1(), and geoalgo::Line::Pt2().

Referenced by _ClosestPt_(), _commonOrigin_(), and commonOrigin().

854  {
855 
856  // Function Description:
857  // Given two HalfLine objects, project them backwards
858  // and find the point of closest approach on both
859  // lines.
860  // The half-point between these two is considered the
861  // candidate origin or vertex of the two lines
862  // Then make segments uniting this vertex and
863  // the start point of both half lines.
864  // Take the dot product of the segment uniting
865  // the vertex with the start of lin1, and the direction
866  // of lin1. Similarly for lin2.
867  // These dot-products will be close to 1 if the lines,
868  // traced backwards, indeed point to the reconstructed
869  // vertex.
870  // return the sum of these dot products, which
871  // is bound between -2 and +2.
872  // other values of this return (1, 0, -1, -2)
873  // will give insight on other possible topologies.
874 
875  // get directions of two lines
876  Vector_t dir1(lin1.Pt2()-lin1.Pt1());
877  Vector_t dir2(lin2.Pt2()-lin2.Pt1());
878  dir1.Normalize();
879  dir2.Normalize();
880 
881  // Closest approach points on the two lines
882  Point_t pt1(lin1.Pt1().size());
883  Point_t pt2(lin2.Pt1().size());
884 
885  //double IP = _SqDist_(lin1, lin2, pt1, pt2);
886  origin = (pt1+pt2)/2.;
887 
888  // If origin coincides with lin1 start
889  // -> vec1 should be in same direction of lin1
890  Vector_t vec1(dir1);
891  if (lin1.Pt1() != origin)
892  vec1 = lin1.Pt1()-origin;
893  vec1.Normalize();
894  // similarly for vec1
895  Vector_t vec2(dir2);
896  if (lin2.Pt1() != origin)
897  vec2 = lin2.Pt1()-origin;
898  vec2.Normalize();
899 
900  return vec1.Dot(dir1) + vec2.Dot(dir2);
901  }
recob::tracking::Point_t Point_t
recob::tracking::Vector_t Vector_t
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::_commonOrigin_ ( const HalfLine_t lin1,
const HalfLine_t lin2,
Point_t origin,
bool  backwards 
) const
protected

Common origin: Half Line & Half Line. Keep track of origin.

Definition at line 905 of file GeoAlgo.cxx.

References _commonOrigin_(), geoalgo::HalfLine::Dir(), geo::origin(), and geoalgo::HalfLine::Start().

906  {
907 
908  //If backwards is false, call infinite line function, otherwise proceed
909  if (!backwards){
910  Line_t l1(lin1.Start(),lin1.Start()+lin1.Dir());
911  Line_t l2(lin2.Start(),lin2.Start()+lin2.Dir());
912  return _commonOrigin_(l1,l2,origin);
913  }
914 
915  // Function Description:
916  // Given two HalfLine objects, project them backwards
917  // and find the point of closest approach on both
918  // lines.
919  // The half-point between these two is considered the
920  // candidate origin or vertex of the two lines
921  // Then make segments uniting this vertex and
922  // the start point of both half lines.
923  // Take the dot product of the segment uniting
924  // the vertex with the start of lin1, and the direction
925  // of lin1. Similarly for lin2.
926  // These dot-products will be close to 1 if the lines,
927  // traced backwards, indeed point to the reconstructed
928  // vertex.
929  // return the sum of these dot products, which
930  // is bound between -2 and +2.
931  // other values of this return (1, 0, -1, -2)
932  // will give insight on other possible topologies.
933 
934  // Flip the HalfLines: want to project backwards
935  HalfLine_t lin1Back(lin1.Start(), lin1.Dir()*(-1));
936  HalfLine_t lin2Back(lin2.Start(), lin2.Dir()*(-1));
937  // Closest approach points on the two lines
938  Point_t pt1(lin1.Start().size());
939  Point_t pt2(lin2.Start().size());
940 
941  // double IP = _SqDist_(lin1Back, lin2Back, pt1, pt2); Unused variable
942  origin = (pt1+pt2)/2.;
943 
944  // If origin coincides with lin1 start
945  // -> vec1 should be in same direction of lin1
946  Vector_t vec1(lin1.Dir());
947  if (lin1.Start() != origin)
948  vec1 = lin1.Start()-origin;
949  vec1.Normalize();
950  // similarly for vec1
951  Vector_t vec2(lin2.Dir());
952  if (lin2.Start() != origin)
953  vec2 = lin2.Start()-origin;
954  vec2.Normalize();
955 
956  return vec1.Dot(lin1.Dir()) + vec2.Dot(lin2.Dir());
957  // std::cout << "dot is: " << dot << std::endl;
958  // if ( !((dot <= 2) && (dot >= -2)) )
959  // throw GeoAlgoException("commonOrigin failed. Sum of two dot-products must be bound by [-2,2]");
960 
961  // return dot;
962  }
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
recob::tracking::Point_t Point_t
recob::tracking::Vector_t Vector_t
Line Line_t
Definition: GeoLine.h:91
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::_commonOrigin_ ( const HalfLine_t lin,
const LineSegment_t seg,
Point_t origin,
bool  backwards 
) const
protected

Common origin: Line Segment & Half Line. Keep track of origin.

Definition at line 964 of file GeoAlgo.cxx.

References _commonOrigin_(), geoalgo::LineSegment::Dir(), and geoalgo::LineSegment::Start().

965  {
966  // Make a Half-line out of the line-segment
967  // we want to project backwards to a common origin
968  // not limit ourselves to an origin that must be on the segment
969  HalfLine_t lin2(seg.Start(), seg.Dir());
970  return _commonOrigin_(lin, lin2, origin, backwards);
971  }
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::_commonOrigin_ ( const LineSegment_t seg1,
const LineSegment_t seg2,
Point_t origin,
bool  backwards 
) const
protected

Common origin: Line Segment & Line Segment. Keep track of origin.

Definition at line 973 of file GeoAlgo.cxx.

References _commonOrigin_(), geoalgo::LineSegment::Dir(), and geoalgo::LineSegment::Start().

974  {
975  // Make a Half-line out of the line-segments
976  // we want to project backwards to a common origin
977  // not limit ourselves to an origin that must be on the segment
978  HalfLine_t lin1(seg1.Start(), seg1.Dir());
979  HalfLine_t lin2(seg2.Start(), seg2.Dir());
980  return _commonOrigin_(lin1, lin2, origin, backwards);
981  }
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::_commonOrigin_ ( const Trajectory_t trj1,
const Trajectory_t trj2,
Point_t origin,
bool  backwards 
) const
protected

Common origin: Trajectory & Trajectory. Keep track of origin.

Common origin: Trajectory & Trajectory/ Keep track of origin.

Definition at line 984 of file GeoAlgo.cxx.

References _commonOrigin_().

985  {
986  // Turn the trajectory into half-line that connect start -> end
987  HalfLine_t lin1(trj1.front(),trj1.back()-trj1.front());
988  // Turn the segment into half-line
989  HalfLine_t lin2(trj2.front(),trj2.back()-trj2.front());
990  return _commonOrigin_(lin1, lin2, origin, backwards);
991  }
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::_commonOrigin_ ( const Trajectory_t trj,
const LineSegment_t seg,
Point_t origin,
bool  backwards 
) const
protected

Common origin: Trajectory & Line Segment. Keep track of origin.

Definition at line 994 of file GeoAlgo.cxx.

References _commonOrigin_(), geoalgo::LineSegment::Dir(), and geoalgo::LineSegment::Start().

995  {
996  // Turn the trajectory into half-line that connect start -> end
997  HalfLine_t lin1(trj.front(),trj.back()-trj.front());
998  // Turn the segment into half-line
999  HalfLine_t lin2(seg.Start(), seg.Dir());
1000  return _commonOrigin_(lin1, lin2, origin, backwards);
1001  }
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::_commonOrigin_ ( const Trajectory_t trj,
const HalfLine_t lin,
Point_t origin,
bool  backwards 
) const
protected

Common origin: Trajectory & Half Line. Keep track of origin.

Definition at line 1004 of file GeoAlgo.cxx.

References _commonOrigin_().

1005  {
1006  // Turn the trajectory into half-line that connect start -> end
1007  HalfLine_t lin2(trj.front(),trj.back()-trj.front());
1008  return _commonOrigin_(lin, lin2, origin, backwards);
1009  }
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
Sphere_t geoalgo::GeoAlgo::_RemainingPoints_ ( std::vector< Point_t > &  remaining,
const Sphere_t thisSphere 
) const
protected

Definition at line 1049 of file GeoAlgo.cxx.

References geoalgo::Sphere::Center(), geoalgo::Sphere::Contain(), dir, geoalgo::Vector::Normalize(), and geoalgo::Sphere::Radius().

Referenced by _boundingSphere_(), and _ClosestPt_().

1051  {
1052 
1053 
1054  // if no points lef -> done...return the current sphere
1055  if (remaining.size() == 0)
1056  return thisSphere;
1057 
1058  //std::cout << "Remaining points: " << remaining.size() << std::endl;
1059 
1060  auto const& lastPoint = remaining.back();
1061 
1062  // if this point is bounded by the already constructed sphere, continue
1063  if ( thisSphere.Contain(lastPoint) ){
1064  remaining.pop_back();
1065  return _RemainingPoints_(remaining,thisSphere);
1066  }
1067  // if not, need to adjust so that the new point is also bound
1068  // get distance from lastPoint and center
1069  double dist = lastPoint.Dist(thisSphere.Center());
1070  //std::cout << "point does not fit: " << lastPoint << std::endl;
1071  //std::cout << "distance: " << dist << std::endl;
1072  //std::cout << "center : " << thisSphere.Center() << std::endl;
1073  //std::cout << "radius : " << thisSphere.Radius() << std::endl;
1074  // the new center should be shifted in the direction
1075  // of the new point by half the difference between
1076  // the current radius and "dist"
1077  // direction in which to move:
1078  Vector_t dir = lastPoint-thisSphere.Center();
1079  dir.Normalize();
1080  // amount to move by
1081  double shift = (dist-thisSphere.Radius())/2.;
1082  if (shift < 0) { shift *= -1; }
1083  Point_t newCenter = thisSphere.Center() + dir*shift;
1084  double newRadius = thisSphere.Radius()+shift;
1085  //std::cout << "new center: " << newCenter << std::endl;
1086  //std::cout << "new radius: " << newRadius << std::endl;
1087  Sphere_t newsphere(newCenter,newRadius);
1088  //if (newsphere.Contain(lastPoint)) { std::cout << "new point contained!" << std::endl; }
1089  //else { std::cout << "WRONG!" << std::endl; }
1090  remaining.pop_back();
1091 
1092  return _RemainingPoints_(remaining,newsphere);
1093  }
recob::tracking::Point_t Point_t
TDirectory * dir
Definition: macro.C:5
Sphere_t _RemainingPoints_(std::vector< Point_t > &remaining, const Sphere_t &thisSphere) const
Definition: GeoAlgo.cxx:1049
recob::tracking::Vector_t Vector_t
Sphere Sphere_t
Definition: GeoSphere.h:119
double geoalgo::GeoAlgo::_SqDist_ ( const Line_t l1,
const Line_t l2,
Point_t L1,
Point_t L2 
) const
protected

Line & Line distance w/o dimensionality check.

Definition at line 192 of file GeoAlgo.cxx.

References _ClosestPt_(), geoalgo::Vector::_SqDist_(), d, e, f, geoalgo::Line::Pt1(), geoalgo::Line::Pt2(), and s.

Referenced by _ClosestPt_(), _SqDist_(), boundingSphere(), ClosestPt(), and SqDist().

193  {
194 
195  // closest approach when segment connecting the two lines
196  // is perpendicular to both lines
197 
198  // L1 = P1 + s(Q1-P1)
199  // L1 = P2 + t(Q2-P2)
200  // L1(s) and L2(t) are the closest approach points
201  // d1 = Q1-P1
202  // d2 = Q2-P2
203  // v(s,t) = L1(s) - L2(t)
204  // require d1*v == 0 && d2*v == 0
205  Vector_t d1 = l1.Pt2()-l1.Pt1();
206  Vector_t d2 = l2.Pt2()-l2.Pt1();
207  Vector_t r = l1.Pt1()-l2.Pt1();
208 
209  double a = d1*d1;
210  double b = d1*d2;
211  double c = d1*r;
212  double e = d2*d2;
213  double f = d2*r;
214 
215  double d = a*e-b*b;
216 
217  // if d==0 the lines are parallel
218  // return Pt1 (doesn't matter) for line 1
219  // distance is distance between Pt1 of 1 line & second line
220  if (d == 0){
221  L1 = l1.Pt1();
222  L2 = _ClosestPt_(l1.Pt1(),l2);
223  return L1._SqDist_(L2);
224  }
225 
226  double s = (b*f-c*e)/d;
227  double t = (a*f-b*c)/d;
228 
229  // s & t represent the paramteric points on the lines
230  // for the closest approach point
231  // now find the Point_t object at those locations
232 
233  L1 = l1.Pt1() + ( l1.Pt2()-l1.Pt1() )*s;
234  L2 = l2.Pt1() + ( l2.Pt2()-l2.Pt1() )*t;
235 
236  // find distance between these points
237  double dist = L1._SqDist_(L2);
238 
239  return dist;
240  }
Float_t s
Definition: plot.C:23
double _SqDist_(const Vector &obj) const
Compute the squared-distance to another vector w/o dimension check.
Definition: GeoVector.cxx:112
TFile f
Definition: plotHisto.C:6
Float_t d
Definition: plot.C:237
Float_t e
Definition: plot.C:34
recob::tracking::Vector_t Vector_t
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
double geoalgo::GeoAlgo::_SqDist_ ( const HalfLine_t l1,
const HalfLine_t l2,
Point_t L1,
Point_t L2 
) const
protected

HalfLine & HalfLine distance w/o dimensionality check.

Definition at line 249 of file GeoAlgo.cxx.

References _ClosestPt_(), geoalgo::Vector::_SqDist_(), d, geoalgo::HalfLine::Dir(), e, f, s, and geoalgo::HalfLine::Start().

250  {
251 
252  //Same as for _SqDist_ with infinite line but check whether s & t go out of bounds (i.e. negative)
253 
254  Vector_t d1 = l1.Dir();
255  Vector_t d2 = l2.Dir();
256  Vector_t r = l1.Start()-l2.Start();
257 
258  double a = d1*d1;
259  double b = d1*d2;
260  double c = d1*r;
261  double e = d2*d2;
262  double f = d2*r;
263 
264  double d = a*e-b*b;
265 
266  // Need to make sure d != 0
267  if ( d==0 ){
268  // lines are parallel
269  // check closest distance from one start point
270  // to other line. Order indifferent
271  // Choose l1 to have cloest point be Start point
272  L1 = l1.Start();
273  L2 = _ClosestPt_(L1,l2);
274  return L1._SqDist_(L2);
275  }
276 
277  double s = (b*f-c*e)/d;
278  double t = (a*f-b*c)/d;
279 
280  // if s or t < 0, out of bounds for half-line
281  if (s < 0) s = 0;
282  if (t < 0) t = 0;
283 
284  // s & t represent the paramteric points on the lines
285  // for the closest approach point
286  // now find the Point_t object at those locations
287 
288  L1 = l1.Start() + l1.Dir()*s;
289  L2 = l2.Start() + l2.Dir()*t;
290 
291  // find distance between these points
292  double dist = L1._SqDist_(L2);
293 
294  return dist;
295  }
Float_t s
Definition: plot.C:23
TFile f
Definition: plotHisto.C:6
Float_t d
Definition: plot.C:237
Float_t e
Definition: plot.C:34
recob::tracking::Vector_t Vector_t
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
double geoalgo::GeoAlgo::_SqDist_ ( const Point_t pt,
const LineSegment_t line 
) const
inlineprotected

Point & LineSegment distance w/o dimensionality check.

Definition at line 390 of file GeoAlgo.h.

References _SqDist_(), geoalgo::LineSegment::End(), and geoalgo::LineSegment::Start().

391  { return _SqDist_(pt,line.Start(),line.End()); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::_SqDist_ ( const Point_t pt,
const Point_t line_s,
const Point_t line_e 
) const
protected

Point & LineSegment distance w/o dimensionality check.

Definition at line 374 of file GeoAlgo.cxx.

References e, and f.

375  {
376  auto const ab = line_e - line_s;
377  auto const ac = pt - line_s;
378  auto const bc = pt - line_e;
379  auto e = ac * ab;
380  if( e <= 0. ) return ac.SqLength();
381  auto f = ab.SqLength();
382  if( e >= f ) return bc.SqLength();
383  return (ac.SqLength() - e * e / f);
384  }
TFile f
Definition: plotHisto.C:6
TMarker * pt
Definition: egs.C:25
Float_t e
Definition: plot.C:34
double geoalgo::GeoAlgo::_SqDist_ ( const LineSegment_t line,
const Point_t pt 
) const
inlineprotected

Point & LineSegment distance w/o dimensionality check.

Definition at line 397 of file GeoAlgo.h.

References _ClosestPt_(), and _SqDist_().

398  { return _SqDist_(pt,line); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::_SqDist_ ( const HalfLine_t hline,
const LineSegment_t seg,
Point_t L1,
Point_t L2 
) const
protected

HalfLine & LineSegment distance w/o dimensionality check.

Definition at line 305 of file GeoAlgo.cxx.

References _Clamp_(), _ClosestPt_(), geoalgo::Vector::_SqDist_(), _SqDist_(), d, geoalgo::HalfLine::Dir(), e, geoalgo::LineSegment::End(), f, s, geoalgo::HalfLine::Start(), and geoalgo::LineSegment::Start().

306  {
307 
308  //Same as for _SqDist_ with infinite line but check whether s & t go out of bounds (i.e. negative)
309 
310  auto const d1 = hline.Dir();
311  auto const d2 = seg.End()-seg.Start();
312  auto const r = hline.Start()-seg.Start();
313 
314  double a = d1*d1;
315  double b = d1*d2;
316  double c = d1*r;
317  double e = d2*d2;
318  double f = d2*r;
319 
320  double d = a*e-b*b;
321 
322  // if parallel then d == 0
323  if (d == 0){
324  // distance is smallest quantity between:
325  // - distance from segment start to line
326  // - distance from segment end to line
327  double sDist = _SqDist_(seg.Start(),hline);
328  double eDist = _SqDist_(seg.End(),hline);
329  if ( sDist <= eDist ) {
330  // get closest point on line
331  L1 = _ClosestPt_(seg.Start(),hline);
332  L2 = seg.Start();
333  return sDist;
334  }
335  else{
336  L1 = _ClosestPt_(seg.End(),hline);
337  L2 = seg.End();
338  return eDist;
339  }
340  }// if parallel
341 
342  double s = (b*f-c*e)/d;
343 
344 
345  // now check if parameters are out of bounds
346  if ( s < 0 ){
347  s = 0; // closest point on half-line is start
348  // re-evaluate closest point on segment using line start point
349  L1 = hline.Start();
350  L2 = _ClosestPt_(L1,seg);
351  return L1._SqDist_(L2);
352  }
353 
354  // if closest point is not beyond half-line
355  // it could be due to an intersection between half-line
356  // and segment projection.
357  // check value of t
358  double t = (a*f-b*c)/d;
359  // if t > 0 && < 1 then the two lines intersect. We are good!
360  if ( (t < 1) and (t > 0) ){
361  L1 = hline.Start() + hline.Dir()*s;
362  L2 = seg.Start() + (seg.End()-seg.Start())*t;
363  return L1._SqDist_(L2);
364  }
365  // if out of bounds clamp
366  // then re-evaluate closest point on line
367  t = _Clamp_(t,0,1);
368  L2 = seg.Start() + (seg.End()-seg.Start())*t;
369  L1 = _ClosestPt_(L2,hline);
370  return L1._SqDist_(L2);
371  }
Float_t s
Definition: plot.C:23
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
double _Clamp_(const double n, const double min, const double max) const
Clamp function: checks if value out of bounds.
Definition: GeoAlgo.cxx:844
TFile f
Definition: plotHisto.C:6
Float_t d
Definition: plot.C:237
Float_t e
Definition: plot.C:34
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
double geoalgo::GeoAlgo::_SqDist_ ( const LineSegment_t seg1,
const LineSegment_t seg2,
Point_t c1,
Point_t c2 
) const
protected

LineSegment & LineSegment distance w/o dimensionality check.

Definition at line 767 of file GeoAlgo.cxx.

References _Clamp_(), c1, e, geoalgo::LineSegment::End(), f, geoalgo::Vector::SqLength(), geoalgo::LineSegment::Start(), t1, and t2.

769  {
770 
771  double t1, t2;
772 
773  auto const& s1 = seg1.Start();
774  auto const& s2 = seg2.Start();
775  auto const& e1 = seg1.End();
776  auto const& e2 = seg2.End();
777 
778  auto d1 = e1 - s1;
779  auto d2 = e2 - s2;
780  auto r = s1 - s2;
781 
782  double a = d1.SqLength();
783  double e = d2.SqLength();
784  double f = d2 * r;
785 
786  // check if segment is too short
787  if ( (a <= 0) and (e <= 0) ){
788  //both segments are too short
789  t1 = t2 = 0.;
790  c1 = s1;
791  c2 = s2;
792  Vector_t distVector = c2 - c1;
793  return distVector.SqLength();
794  }
795  if (a <= 0){
796  //first segment degenerates into a point
797  t1 = 0.;
798  t2 = f/e;
799  t2 = _Clamp_(t2,0.,1.);
800  }
801  else{
802  double c = d1 * r;
803  if (e <= 0){
804  //second segment degenerates into a point
805  t2 = 0.;
806  t1 = _Clamp_(-c/a,0.,1.);
807  }
808  else{
809  // the general case...no degeneracies
810  double b = d1 * d2;
811  double denom = (a*e)-(b*b);
812 
813  if (denom != 0.)
814  t1 = _Clamp_((b*f-c*e)/denom, 0., 1.);
815  else
816  t1 = 0.;
817 
818  t2 = (b*t1+f)/e;
819 
820  if (t2 < 0.){
821  t2 = 0.;
822  t1 = _Clamp_(-c/a, 0., 1.);
823  }
824  else if (t2 > 1.){
825  t2 = 1.;
826  t1 = _Clamp_((b-c)/a, 0., 1.);
827  }
828 
829  }
830  }
831 
832  c1 = s1 + d1 * t1;
833  c2 = s2 + d2 * t2;
834 
835  Vector_t distVector = c2 - c1;
836  return distVector.SqLength();
837 
838  }
TTree * t1
Definition: plottest35.C:26
double _Clamp_(const double n, const double min, const double max) const
Clamp function: checks if value out of bounds.
Definition: GeoAlgo.cxx:844
TFile f
Definition: plotHisto.C:6
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
TTree * t2
Definition: plottest35.C:36
Float_t e
Definition: plot.C:34
recob::tracking::Vector_t Vector_t
double geoalgo::GeoAlgo::_SqDist_ ( const Point_t pt,
const HalfLine_t line 
) const
protected

Point & HalfLine distance w/o dimensionality check.

Definition at line 405 of file GeoAlgo.cxx.

References geoalgo::HalfLine::Dir(), e, f, and geoalgo::HalfLine::Start().

406  {
407  auto const& ab = line.Dir();
408  auto const ac = pt - line.Start();
409  auto const bc = ac - ab;
410 
411  auto e = ac * ab;
412  if( e <= 0. ) return (ac * ac);
413  auto f = ab.SqLength();
414  return (ac.SqLength() - e * e / f);
415  }
TFile f
Definition: plotHisto.C:6
TMarker * pt
Definition: egs.C:25
Float_t e
Definition: plot.C:34
double geoalgo::GeoAlgo::_SqDist_ ( const HalfLine_t line,
const Point_t pt 
) const
inlineprotected

Point & HalfLine distance w/o dimensionality check.

Definition at line 415 of file GeoAlgo.h.

References _ClosestPt_(), and _SqDist_().

416  { return _SqDist_(pt,line); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::_SqDist_ ( const Line_t line,
const Point_t pt 
) const
protected

Definition at line 431 of file GeoAlgo.cxx.

References e, f, geoalgo::Line::Pt1(), and geoalgo::Line::Pt2().

432  {
433  auto const ab = line.Pt2()-line.Pt1();
434  auto const ac = pt - line.Pt1();
435  auto const bc = ac - ab;
436 
437  auto e = ac * ab;
438  auto f = ab.SqLength();
439  return (ac.SqLength() - e * e / f);
440  }
TFile f
Definition: plotHisto.C:6
TMarker * pt
Definition: egs.C:25
Float_t e
Definition: plot.C:34
double geoalgo::GeoAlgo::_SqDist_ ( const Point_t pt,
const Line_t line 
) const
inlineprotected

Definition at line 431 of file GeoAlgo.h.

References _SqDist_().

432  { return _SqDist_(line,pt); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::_SqDist_ ( const Point_t pt,
const AABox_t box 
) const
protected

Point & AABox distance w/o dimensionality check.

Definition at line 453 of file GeoAlgo.cxx.

References geoalgo::AABox::Contain(), geoalgo::kINVALID_DOUBLE, geoalgo::AABox::Max(), and geoalgo::AABox::Min().

454  {
455  double dist = kINVALID_DOUBLE;
456 
457  // If a point is inside the box, simply compute the smallest perpendicular distance
458  if(box.Contain(pt)) {
459 
460  auto const& pt_min = box.Min();
461  auto const& pt_max = box.Max();
462  // (1) Compute the distance to the YZ wall
463  double dist_to_yz = pt[0] - pt_min[0];
464  if( dist_to_yz > (pt_max[0] - pt[0]) ) dist_to_yz = pt_max[0] - pt[0];
465 
466  // (2) Compute the distance to the XZ wall
467  double dist_to_zx = pt[1] - pt_min[1];
468  if( dist_to_zx > (pt_max[1] - pt[1]) ) dist_to_zx = pt_max[1] - pt[1];
469 
470  // (3) Compute the distance to the XY wall
471  double dist_to_xy = pt[2] - pt_min[2];
472  if( dist_to_xy > (pt_max[2] - pt[2]) ) dist_to_xy = pt_max[2] - pt[2];
473 
474  // (4) Compute the minimum of (3), (4), and (5)
475  dist = ( dist_to_yz < dist_to_zx ? dist_to_yz : dist_to_zx );
476  dist = ( dist < dist_to_xy ? dist : dist_to_xy );
477  dist *= dist;
478 
479  }
480 
481  else{
482  // This refers to Ref. RTCD 5.1.3.1
483  // re-set distance
484  dist = 0;
485  for(size_t i=0; i<pt.size(); ++i) {
486 
487  auto const& v_pt = pt[i];
488  auto const& v_max = box.Max()[i];
489  auto const& v_min = box.Min()[i];
490 
491  if(v_pt < v_min) dist += (v_min - v_pt) * (v_min - v_pt);
492  if(v_pt > v_max) dist += (v_pt - v_max) * (v_pt - v_max);
493  }
494  }
495  return dist;
496  }
TMarker * pt
Definition: egs.C:25
static const double kINVALID_DOUBLE
double geoalgo::GeoAlgo::_SqDist_ ( const AABox_t box,
const Point_t pt 
) const
inlineprotected

Point & AABox distance w/o dimensionality check.

Definition at line 437 of file GeoAlgo.h.

References _ClosestPt_(), and _SqDist_().

438  { return _SqDist_(pt,box); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
void geoalgo::GeoAlgo::_Swap_ ( double &  tmin,
double &  tmax 
) const
inlineprotected

Swap two points if min & max are inverted.

Definition at line 471 of file GeoAlgo.h.

472  { if(tmin > tmax) std::swap(tmin,tmax); }
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
Sphere_t geoalgo::GeoAlgo::_WelzlSphere_ ( const std::vector< Point_t > &  pts,
int  numPts,
std::vector< Point_t sosPts 
) const
protected

Definition at line 1095 of file GeoAlgo.cxx.

References geoalgo::Sphere::Contain().

Referenced by _ClosestPt_().

1098  {
1099 
1100  if (numPts == 0)
1101  return Sphere_t(sosPts);
1102  // choose last point in the input set as the one to test (if it fits in current sphere or not)
1103  int index = numPts-1;
1104  // recursively compute the smallest bounding sphere of the remaining points
1105  Sphere_t smallestSphere = _WelzlSphere_(pts, numPts-1, sosPts);
1106  // if the selected point lies inside this sphere, it is indeed the smallest
1107  if ( smallestSphere.Contain(pts[index]) )
1108  return smallestSphere;
1109  // otherwise, update the set-of-support to additionally contain the new point
1110  sosPts.push_back(pts[index]);
1111  return _WelzlSphere_(pts, numPts-1, sosPts);
1112  }
Sphere_t _WelzlSphere_(const std::vector< Point_t > &pts, int numPts, std::vector< Point_t > sosPts) const
Definition: GeoAlgo.cxx:1095
Sphere Sphere_t
Definition: GeoSphere.h:119
Sphere_t geoalgo::GeoAlgo::boundingSphere ( const std::vector< Point_t > &  pts) const
inline

Definition at line 378 of file GeoAlgo.h.

References _boundingSphere_(), _SqDist_(), and geoalgo::Sphere::compat().

379  { for(auto &p : pts) { pts.front().compat(p); } return _boundingSphere_(pts); }
Sphere_t _boundingSphere_(const std::vector< Point_t > &pts) const
Definition: GeoAlgo.cxx:1014
LineSegment_t geoalgo::GeoAlgo::BoxOverlap ( const AABox_t box,
const HalfLine_t line 
) const

LineSegment sub-segment of HalfLine inside an AABox.

Definition at line 166 of file GeoAlgo.cxx.

References Intersection(), and geoalgo::HalfLine::Start().

Referenced by BoxOverlap(), and Intersection().

167  {
168  // First find interection point of half-line and box
169  auto xs_v = Intersection(box, line);
170  if(xs_v.size()==2) return LineSegment_t(xs_v[0],xs_v[1]);
171 
172  // Build a new LineSegment
173  if(!(xs_v.size())) return LineSegment_t();
174 
175  // Only other possiblity is # = 1
176  return LineSegment_t(line.Start(),xs_v[0]);
177  }
LineSegment LineSegment_t
std::vector< Point_t > Intersection(const AABox_t &box, const HalfLine_t &line, bool back=false) const
Intersection between a HalfLine and an AABox.
Definition: GeoAlgo.cxx:10
LineSegment_t geoalgo::GeoAlgo::BoxOverlap ( const HalfLine_t line,
const AABox_t box 
) const
inline

LineSegment sub-segment of HalfLine inside an AABox.

Definition at line 77 of file GeoAlgo.h.

References BoxOverlap().

78  { return BoxOverlap(box, line); }
LineSegment_t BoxOverlap(const AABox_t &box, const HalfLine_t &line) const
LineSegment sub-segment of HalfLine inside an AABox.
Definition: GeoAlgo.cxx:166
Trajectory_t geoalgo::GeoAlgo::BoxOverlap ( const AABox_t box,
const Trajectory_t trj 
) const

Get Trajectory inside box given some input trajectory -> now assumes trajectory cannot exit and re-enter box.

Definition at line 180 of file GeoAlgo.cxx.

References geoalgo::AABox::Contain().

181  {
182 
183  // if first & last points inside, then return full trajectory
184  if ( box.Contain(trj[0]) and box.Contain(trj.back()) )
185  return trj;
186 
187  return trj;
188  }
Trajectory_t geoalgo::GeoAlgo::BoxOverlap ( const Trajectory_t trj,
const AABox_t box 
) const
inline

Get Trajectory inside box given some input trajectory -> now assumes trajectory cannot exit and re-enter box.

Definition at line 84 of file GeoAlgo.h.

References BoxOverlap().

85  { return BoxOverlap(box, trj); }
LineSegment_t BoxOverlap(const AABox_t &box, const HalfLine_t &line) const
LineSegment sub-segment of HalfLine inside an AABox.
Definition: GeoAlgo.cxx:166
Point_t geoalgo::GeoAlgo::ClosestPt ( const Line_t line,
const Point_t pt 
) const
inline

Definition at line 98 of file GeoAlgo.h.

References _ClosestPt_(), geoalgo::Vector::compat(), and geoalgo::Line::Pt1().

Referenced by ClosestPt(), and SqDist().

99  { pt.compat(line.Pt1()); return _ClosestPt_(pt,line); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::ClosestPt ( const Point_t pt,
const Line_t line 
) const
inline

Definition at line 101 of file GeoAlgo.h.

References _ClosestPt_().

102  { return _ClosestPt_(pt,line); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::ClosestPt ( const Point_t pt,
const Trajectory_t trj 
) const
inline

Point_t & Trajectory_t closest point.

Definition at line 205 of file GeoAlgo.h.

References ClosestPt().

206  { int idx=0; return ClosestPt(pt,trj,idx); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::ClosestPt ( const Trajectory_t trj,
const Point_t pt 
) const
inline

Point_t & Trajectory_t closest point.

Definition at line 208 of file GeoAlgo.h.

References ClosestPt().

209  { int idx=0; return ClosestPt(pt,trj,idx); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::ClosestPt ( const Point_t pt,
const Trajectory_t trj,
int &  idx 
) const

Point_t & Trajectory_t closest point. Keep track of index of segment.

Definition at line 574 of file GeoAlgo.cxx.

References _ClosestPt_(), _SqDist_(), geoalgo::Trajectory::compat(), and geoalgo::kINVALID_DOUBLE.

575  {
576 
577  // Make sure trajectory object is properly defined
578  if (!trj.size())
579  throw GeoAlgoException("Trajectory object not properly set...");
580 
581  // Check dimensionality compatibility between point and trajectory
582  trj.compat(pt);
583 
584  // Now keep track of smallest distance and loop over traj segments
585  double distMin = kINVALID_DOUBLE;
586  // For that smallest distance, keep track of the segment for which it was found
587  for (size_t l=0; l < trj.size()-1; l++){
588  double distTmp = _SqDist_(pt,trj[l],trj[l+1]);
589  if (distTmp < distMin) { distMin = distTmp; idx = l; }
590  }
591 
592  // Now that we have the segment for the closest approach
593  // Use it to find the closest point on that segment
594  LineSegment_t segMin(trj[idx], trj[idx+1]);
595  return _ClosestPt_(pt,segMin);
596  }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
LineSegment LineSegment_t
TMarker * pt
Definition: egs.C:25
static const double kINVALID_DOUBLE
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::ClosestPt ( const Trajectory_t trj,
const Point_t pt,
int &  idx 
) const
inline

Point_t & Trajectory_t closest point. Keep track of index of segment.

Definition at line 213 of file GeoAlgo.h.

References ClosestPt(), and SqDist().

214  { return ClosestPt(pt,trj,idx); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::ClosestPt ( const Point_t pt,
const std::vector< geoalgo::Trajectory_t > &  trj,
int &  trackIdx 
) const

Point_t & Trajectory_t closest point - keep track of which track is closest.

Definition at line 603 of file GeoAlgo.cxx.

References ClosestPt(), geoalgo::kINVALID_DOUBLE, and SqDist().

604  {
605 
606  // since finding the smallest distance is faster than finding the closest point
607  // first loop through tracks, and find the one that is closest to the point
608  // then finally find the closest point on that track
609 
610  for (size_t t=0; t < trj.size(); t++){
611 
612  // holder for smallest distance
613  double minDist = kINVALID_DOUBLE;
614 
615  // track & point dimensionality will be checked per-track by next function
616  // now calculate distance w.r.t. this track
617  double tmpDist = SqDist(pt, trj[t]);
618  if (tmpDist < minDist){
619  minDist = tmpDist;
620  TrackIdx = t;
621  }
622 
623  }// for all tracks
624 
625  // now we know which track is closest -> find the closest point to that track
626  return ClosestPt(pt, trj[TrackIdx]);
627  }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
static const double kINVALID_DOUBLE
Point_t geoalgo::GeoAlgo::ClosestPt ( const std::vector< geoalgo::Trajectory_t > &  trj,
const Point_t pt,
int &  trackIdx 
) const
inline

Point_t & Trajectory_t closest point - keep track of which track is closest.

Definition at line 234 of file GeoAlgo.h.

References ClosestPt().

235  { return ClosestPt(pt, trj, trackIdx); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::ClosestPt ( const Point_t pt,
const std::vector< geoalgo::Trajectory_t > &  trj 
) const
inline

Point_t & Trajectory_t closest point - don't keep track of which track is closest.

Definition at line 237 of file GeoAlgo.h.

References ClosestPt().

238  { int trackIdx; return ClosestPt(pt, trj, trackIdx); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::ClosestPt ( const std::vector< geoalgo::Trajectory_t > &  trj,
const Point_t pt 
) const
inline

Point_t & Trajectory_t closest point - don't keep track of which track is closest.

Definition at line 240 of file GeoAlgo.h.

References ClosestPt().

241  { int trackIdx; return ClosestPt(pt, trj, trackIdx); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::ClosestPt ( const Point_t pt,
const LineSegment_t line 
) const
inline

Point & LineSegment closest point.

Definition at line 254 of file GeoAlgo.h.

References _ClosestPt_(), geoalgo::Vector::compat(), and geoalgo::LineSegment::Start().

255  { pt.compat(line.Start()); return _ClosestPt_(pt,line); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::ClosestPt ( const LineSegment_t line,
const Point_t pt 
) const
inline

Point & LineSegment closest point.

Definition at line 257 of file GeoAlgo.h.

References ClosestPt().

258  { return ClosestPt(pt,line); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::ClosestPt ( const Point_t pt,
const HalfLine_t line 
) const
inline

Point & HalfLine closest point.

Definition at line 270 of file GeoAlgo.h.

References _ClosestPt_(), geoalgo::Vector::compat(), and geoalgo::HalfLine::Start().

271  { pt.compat(line.Start()); return _ClosestPt_(pt,line); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::ClosestPt ( const HalfLine_t line,
const Point_t pt 
) const
inline

Point & HalfLine closest point.

Definition at line 273 of file GeoAlgo.h.

References ClosestPt().

274  { return ClosestPt(pt,line); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
Point_t geoalgo::GeoAlgo::ClosestPt ( const Point_t pt,
const AABox_t box 
) const
inline

Point & AABox closest point.

Definition at line 303 of file GeoAlgo.h.

References _ClosestPt_(), geoalgo::Vector::compat(), and geoalgo::AABox::Min().

304  { pt.compat(box.Min()); return _ClosestPt_(pt,box); }
TMarker * pt
Definition: egs.C:25
Point_t _ClosestPt_(const Point_t &pt, const LineSegment_t &line) const
Definition: GeoAlgo.cxx:387
Point_t geoalgo::GeoAlgo::ClosestPt ( const AABox_t box,
const Point_t pt 
) const
inline

Point & AABox closest point.

Definition at line 306 of file GeoAlgo.h.

References ClosestPt().

307  { return ClosestPt(pt,box); }
Point_t ClosestPt(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::commonOrigin ( const Line_t lin1,
const Line_t lin2 
) const
inline

Common origin: Line Segment & Line Segment. Do not keep track of origin.

Definition at line 314 of file GeoAlgo.h.

References geo::origin(), and geoalgo::Line::Pt1().

Referenced by commonOrigin().

315  { Point_t origin(lin1.Pt1().size()); return commonOrigin(lin1,lin2, origin); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const Line_t lin1,
const Line_t lin2,
Point_t origin 
) const
inline

Common origin: Line Segment & Line Segment. Keep track of origin.

Definition at line 317 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Vector::compat(), and geoalgo::Line::Pt1().

318  { lin1.Pt1().compat(lin2.Pt1()); return _commonOrigin_(lin1, lin2, origin); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const LineSegment_t seg1,
const LineSegment_t seg2,
bool  backwards = false 
) const
inline

Common origin: Line Segment & Line Segment. Do not keep track of origin.

Definition at line 320 of file GeoAlgo.h.

References commonOrigin(), geo::origin(), and geoalgo::LineSegment::Start().

321  { Point_t origin(seg1.Start().size()); return commonOrigin(seg1,seg2, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const LineSegment_t seg1,
const LineSegment_t seg2,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Line Segment & Line Segment. Keep track of origin.

Definition at line 323 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Vector::compat(), and geoalgo::LineSegment::Start().

324  { seg1.Start().compat(seg2.Start()); return _commonOrigin_(seg1, seg2, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const HalfLine_t lin,
const LineSegment_t seg,
bool  backwards = false 
) const
inline

Common origin: Line Segment & Half Line. Do not keep track of origin.

Definition at line 326 of file GeoAlgo.h.

References commonOrigin(), geo::origin(), and geoalgo::HalfLine::Start().

327  { Point_t origin(lin.Start().size()); return commonOrigin(lin, seg, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const HalfLine_t lin,
const LineSegment_t seg,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Line Segment & Line Segment. Keep track of origin.

Definition at line 329 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Vector::compat(), geoalgo::HalfLine::Start(), and geoalgo::LineSegment::Start().

330  { lin.Start().compat(seg.Start()); return _commonOrigin_(lin, seg, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const LineSegment_t seg,
const HalfLine_t lin,
bool  backwards = false 
) const
inline

Common origin: Line Segment & Half Line. Do not keep track of origin.

Definition at line 332 of file GeoAlgo.h.

References commonOrigin(), geo::origin(), and geoalgo::HalfLine::Start().

333  { Point_t origin(lin.Start().size()); return commonOrigin(lin, seg, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const LineSegment_t seg,
const HalfLine_t lin,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Line Segment & Line Segment. Keep track of origin.

Definition at line 335 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Vector::compat(), geoalgo::HalfLine::Start(), and geoalgo::LineSegment::Start().

336  { lin.Start().compat(seg.Start()); return _commonOrigin_(lin, seg, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const HalfLine_t lin1,
const HalfLine_t lin2,
bool  backwards = false 
) const
inline

Common origin: Half Line & Half Line. Do not keep track of origin.

Definition at line 338 of file GeoAlgo.h.

References commonOrigin(), geo::origin(), and geoalgo::HalfLine::Start().

339  { Point_t origin(lin1.Start().size()); return commonOrigin(lin1,lin2, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const HalfLine_t lin1,
const HalfLine_t lin2,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Half Line & Half Line. Keep track of origin.

Definition at line 341 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Vector::compat(), and geoalgo::HalfLine::Start().

342  { lin1.Start().compat(lin2.Start()); return _commonOrigin_(lin1, lin2, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const Trajectory_t trj1,
const Trajectory_t trj2,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Trajectory. Do not keep track of origin.

Definition at line 344 of file GeoAlgo.h.

References commonOrigin(), and geo::origin().

345  { Point_t origin(trj1.front().size()); return commonOrigin(trj1,trj2, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const Trajectory_t trj1,
const Trajectory_t trj2,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Trajectory. Keep track of origin.

Definition at line 347 of file GeoAlgo.h.

References _commonOrigin_(), and geoalgo::Trajectory::compat().

348  { trj1.front().compat(trj2.front()); return _commonOrigin_(trj1, trj2, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const Trajectory_t trj,
const HalfLine_t lin,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Half Line. Do not keep track of origin.

Definition at line 350 of file GeoAlgo.h.

References commonOrigin(), and geo::origin().

351  { Point_t origin(trj.front().size()); return commonOrigin(trj,lin, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const Trajectory_t trj,
const HalfLine_t lin,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Half Line. Keep track of origin.

Definition at line 353 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Trajectory::compat(), and geoalgo::HalfLine::Start().

354  { trj.front().compat(lin.Start()); return _commonOrigin_(trj, lin, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const HalfLine_t lin,
const Trajectory_t trj,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Half Line. Do not keep track of origin.

Definition at line 356 of file GeoAlgo.h.

References commonOrigin(), and geo::origin().

357  { Point_t origin(trj.front().size()); return commonOrigin(trj,lin, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const HalfLine_t lin,
const Trajectory_t trj,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Half Line. Keep track of origin.

Definition at line 359 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Trajectory::compat(), and geoalgo::HalfLine::Start().

360  { trj.front().compat(lin.Start()); return _commonOrigin_(trj, lin, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const Trajectory_t trj,
const LineSegment_t seg,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Line Segment. Do not keep track of origin.

Definition at line 362 of file GeoAlgo.h.

References commonOrigin(), and geo::origin().

363  { Point_t origin(trj.front().size()); return commonOrigin(trj, seg, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const Trajectory_t trj,
const LineSegment_t seg,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Line Segment. Keep track of origin.

Definition at line 365 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Trajectory::compat(), and geoalgo::LineSegment::Start().

366  { trj.front().compat(seg.Start()); return _commonOrigin_(trj, seg, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const LineSegment_t seg,
const Trajectory_t trj,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Line Segment. Do not keep track of origin.

Definition at line 368 of file GeoAlgo.h.

References commonOrigin(), and geo::origin().

369  { Point_t origin(trj.front().size()); return commonOrigin(trj, seg, origin, backwards); }
recob::tracking::Point_t Point_t
double commonOrigin(const Line_t &lin1, const Line_t &lin2) const
Common origin: Line Segment & Line Segment. Do not keep track of origin.
Definition: GeoAlgo.h:314
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
double geoalgo::GeoAlgo::commonOrigin ( const LineSegment_t seg,
const Trajectory_t trj,
Point_t origin,
bool  backwards = false 
) const
inline

Common origin: Trajectory & Line Segment. Keep track of origin.

Definition at line 371 of file GeoAlgo.h.

References _commonOrigin_(), geoalgo::Trajectory::compat(), and geoalgo::LineSegment::Start().

372  { trj.front().compat(seg.Start()); return _commonOrigin_(trj, seg, origin, backwards); }
double _commonOrigin_(const Line_t &lin1, const Line_t &lin2, Point_t &origin) const
Common origin: Line & Line. Keep track of origin.
Definition: GeoAlgo.cxx:853
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
std::vector< Point_t > geoalgo::GeoAlgo::Intersection ( const AABox_t box,
const HalfLine_t line,
bool  back = false 
) const

Intersection between a HalfLine and an AABox.

Definition at line 10 of file GeoAlgo.cxx.

References geoalgo::Vector::_SqDist_(), dir, geoalgo::HalfLine::Dir(), geoalgo::Vector::IsValid(), geoalgo::AABox::Max(), geoalgo::AABox::Min(), s, and geoalgo::HalfLine::Start().

Referenced by BoxOverlap(), Intersection(), and ~GeoAlgo().

13  {
14  // Result container
15  std::vector<Point_t> result;
16  Point_t xs1(3); // Only 2 points max possible
17  Point_t xs2(3); // Create in advance for early termination checks
18  // One-time only initialization for unit vectors
19  static std::vector<Point_t> min_plane_n;
20  static std::vector<Point_t> max_plane_n;
21  if(!min_plane_n.size()) {
22  min_plane_n.reserve(3);
23  min_plane_n.push_back(Vector_t(-1,0,0));
24  min_plane_n.push_back(Vector_t(0,-1,0));
25  min_plane_n.push_back(Vector_t(0,0,-1));
26  max_plane_n.reserve(3);
27  max_plane_n.push_back(Vector_t(1,0,0));
28  max_plane_n.push_back(Vector_t(0,1,0));
29  max_plane_n.push_back(Vector_t(0,0,1));
30  }
31  // min/max points of the AABox
32  auto const& min_pt = box.Min();
33  auto const& max_pt = box.Max();
34  // start/dir of the line
35  auto const& start = line.Start();
36  auto dir = line.Dir();
37  if(back) dir *= -1;
38  // Inspect the case of parallel line
39  for(size_t i=0; i<min_pt.size(); ++i) {
40  if ( dir[i] == 0 &&
41  (start[i] <= min_pt[i] || max_pt[i] <= start[i]) )
42  return result;
43  }
44  // Look for xs w/ 3 planes
45  for(size_t i=0; i<3; ++i) {
46  auto const& normal = min_plane_n[i];
47  double s = (-1.) * ( normal * (start - min_pt) ) / (normal * dir);
48  if(s<0) continue;
49  auto xs = start + dir * s;
50  // Check if the found point is within the surface area of other 2 axis
51  bool on_surface=true;
52  for(size_t sur_axis=0; sur_axis<3; ++sur_axis) {
53  if(sur_axis==i) continue;
54  if(xs[sur_axis] < min_pt[sur_axis] || max_pt[sur_axis] < xs[sur_axis]) {
55  on_surface=false;
56  break;
57  }
58  }
59  if(on_surface && xs != xs1) {
60  // Directly assign to xs1 instead of making a copy
61  if(!(xs1.IsValid())) for(size_t j=0; j<3; ++j) xs1[j]=xs[j];
62  else {
63  // If xs2 is filled, no more point to search. Exit.
64  for(size_t j=0; j<3; ++j) xs2[j]=xs[j];
65  break;
66  }
67  }
68  }
69  // If xs2 is filled, simply return the result. Order the output via distance
70  if(xs2.IsValid()) {
71  result.reserve(2);
72  if(xs1._SqDist_(start) > xs2._SqDist_(start)) std::swap(xs1,xs2);
73  result.push_back(xs1);
74  result.push_back(xs2);
75  return result;
76  }
77  // Look for xs w/ 3 planes
78  for(size_t i=0; i<3; ++i) {
79  auto const& normal = max_plane_n[i];
80  double s = (-1.) * ( normal * (start - max_pt) ) / (normal * dir);
81  if(s<0) continue;
82  auto xs = start + dir * s;
83  bool on_surface=true;
84  for(size_t sur_axis=0; sur_axis<3; ++sur_axis) {
85  if(sur_axis==i) continue;
86  if(xs[sur_axis] < min_pt[sur_axis] || max_pt[sur_axis] < xs[sur_axis]) {
87  on_surface=false;
88  break;
89  }
90  }
91  if(on_surface && xs != xs1) {
92  if(!(xs1.IsValid())) for(size_t j=0; j<3; ++j) xs1[j]=xs[j];
93  else {
94  for(size_t j=0; j<3; ++j) xs2[j]=xs[j];
95  break;
96  }
97  }
98  }
99  if(!xs1.IsValid()) return result;
100  if(xs2.IsValid()) {
101  result.reserve(2);
102  if(xs1._SqDist_(start) > xs2._SqDist_(start)) std::swap(xs1,xs2);
103  result.push_back(xs1);
104  result.push_back(xs2);
105  return result;
106  }
107  result.push_back(xs1);
108  return result;
109  }
Float_t s
Definition: plot.C:23
recob::tracking::Point_t Point_t
TDirectory * dir
Definition: macro.C:5
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:199
std::vector<Point_t> geoalgo::GeoAlgo::Intersection ( const HalfLine_t line,
const AABox_t box,
bool  back = false 
) const
inline

Intersection between a HalfLine and an AABox.

Definition at line 59 of file GeoAlgo.h.

References Intersection().

60  { return Intersection(box, line, back); }
std::vector< Point_t > Intersection(const AABox_t &box, const HalfLine_t &line, bool back=false) const
Intersection between a HalfLine and an AABox.
Definition: GeoAlgo.cxx:10
std::vector< Point_t > geoalgo::GeoAlgo::Intersection ( const AABox_t box,
const LineSegment_t l 
) const

Intersection between LineSegment and an AABox.

Definition at line 112 of file GeoAlgo.cxx.

References geoalgo::HalfLine::Dir(), geoalgo::LineSegment::End(), Intersection(), pt, geoalgo::HalfLine::Start(), and geoalgo::LineSegment::Start().

114  {
115  auto const& st = line.Start();
116  auto const& ed = line.End();
117  // Create a static HalfLine_t for this algorithm
118  static HalfLine_t hline(st,ed-st);
119  hline.Start(st[0],st[1],st[2]);
120  hline.Dir(ed[0]-st[0],ed[1]-st[1],ed[2]-st[2]);
121 
122  auto hline_result = Intersection(box,hline);
123 
124  if(!hline_result.size()) return hline_result;
125 
126  // For non-empty result, only keep ones that is within the line length
127  std::vector<Point_t> result;
128  auto length = st._SqDist_(ed);
129  for(auto const& pt : hline_result)
130  if(st._SqDist_(pt) < length) result.push_back(pt);
131  return result;
132  }
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
TMarker * pt
Definition: egs.C:25
std::vector< Point_t > Intersection(const AABox_t &box, const HalfLine_t &line, bool back=false) const
Intersection between a HalfLine and an AABox.
Definition: GeoAlgo.cxx:10
std::vector<Point_t> geoalgo::GeoAlgo::Intersection ( const LineSegment_t l,
const AABox_t box 
) const
inline

Intersection between LineSegment and an AABox.

Definition at line 65 of file GeoAlgo.h.

References Intersection().

66  { return Intersection(box,l); }
std::vector< Point_t > Intersection(const AABox_t &box, const HalfLine_t &line, bool back=false) const
Intersection between a HalfLine and an AABox.
Definition: GeoAlgo.cxx:10
std::vector< Point_t > geoalgo::GeoAlgo::Intersection ( const AABox_t box,
const Trajectory_t trj 
) const

Intersection between Trajectory and an AABox.

Definition at line 135 of file GeoAlgo.cxx.

References geoalgo::Trajectory::compat(), geoalgo::HalfLine::Dir(), Intersection(), geoalgo::AABox::Min(), pt, and geoalgo::HalfLine::Start().

137  {
138 
139  std::vector<Point_t> result;
140  if(trj.size() < 2) return result; // If only 1 point, return
141  // Check compat
142  trj.compat(box.Min());
143  // Call the onetime-only HalfLine constructor
144  static HalfLine_t hline(trj[0],trj[1]);
145  for(size_t i=0; i<trj.size()-1; ++i) {
146 
147  auto const& st = trj[i];
148  auto const& ed = trj[i+1];
149  hline.Start(st[0],st[1],st[2]);
150  hline.Dir(ed[0]-st[0],ed[1]-st[1],ed[2]-st[2]);
151 
152  auto hline_result = Intersection(box,hline);
153 
154  if(!hline_result.size()) continue;
155 
156  // Check if the length makes sense
157  auto length = st._SqDist_(ed);
158  for(auto const& pt : hline_result)
159  if(st._SqDist_(pt) < length) result.push_back(pt);
160 
161  }
162  return result;
163  }
HalfLine HalfLine_t
Definition: GeoHalfLine.h:88
TMarker * pt
Definition: egs.C:25
std::vector< Point_t > Intersection(const AABox_t &box, const HalfLine_t &line, bool back=false) const
Intersection between a HalfLine and an AABox.
Definition: GeoAlgo.cxx:10
std::vector<Point_t> geoalgo::GeoAlgo::Intersection ( const Trajectory_t trj,
const AABox_t box 
) const
inline

Intersection between Trajectory and an AABox.

Definition at line 71 of file GeoAlgo.h.

References BoxOverlap(), and Intersection().

72  { return Intersection(box,trj); }
std::vector< Point_t > Intersection(const AABox_t &box, const HalfLine_t &line, bool back=false) const
Intersection between a HalfLine and an AABox.
Definition: GeoAlgo.cxx:10
double geoalgo::GeoAlgo::SqDist ( const Line_t line,
const Point_t pt 
) const
inline

Definition at line 92 of file GeoAlgo.h.

References _SqDist_(), geoalgo::Vector::compat(), and geoalgo::Line::Pt1().

Referenced by ClosestPt(), geoalgo::Cylinder::Contain(), and SqDist().

93  { pt.compat(line.Pt1()); return _SqDist_(line,pt); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const Point_t pt,
const Line_t line 
) const
inline

Definition at line 95 of file GeoAlgo.h.

References SqDist().

96  { return SqDist(line,pt); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const Line_t l1,
const Line_t l2,
Point_t L1,
Point_t L2 
) const
inline

Definition at line 109 of file GeoAlgo.h.

References _SqDist_(), geoalgo::Vector::compat(), and geoalgo::Line::Pt1().

110  { l1.Pt1().compat(l2.Pt1()); return _SqDist_(l1, l2, L1, L2); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
double geoalgo::GeoAlgo::SqDist ( const Line_t l1,
const Line_t l2 
) const
inline

Definition at line 112 of file GeoAlgo.h.

References SqDist().

113  { Point_t L1; Point_t L2; return SqDist(l1, l2, L1, L2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
double geoalgo::GeoAlgo::SqDist ( const HalfLine_t l1,
const HalfLine_t l2,
Point_t L1,
Point_t L2 
) const
inline

Definition at line 120 of file GeoAlgo.h.

References _SqDist_(), geoalgo::Vector::compat(), and geoalgo::HalfLine::Start().

121  { l1.Start().compat(l2.Start()); return _SqDist_(l1, l2, L1, L2); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
double geoalgo::GeoAlgo::SqDist ( const HalfLine_t l1,
const HalfLine_t l2 
) const
inline

Definition at line 123 of file GeoAlgo.h.

References SqDist().

124  { Point_t L1; Point_t L2; return SqDist(l1, l2, L1, L2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t seg1,
const LineSegment_t seg2,
Point_t c1,
Point_t c2 
) const
inline

LineSegment_t & LineSegment_t distance - keep track of points.

Definition at line 131 of file GeoAlgo.h.

References _SqDist_(), geoalgo::Vector::compat(), and geoalgo::LineSegment::Start().

132  { seg1.Start().compat(seg2.Start()); return _SqDist_(seg1, seg2, c1, c2); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t seg1,
const LineSegment_t seg2 
) const
inline

LineSegment & LineSegment, don't keep track of points.

Definition at line 134 of file GeoAlgo.h.

References c1, c2, and SqDist().

135  { Point_t c1; Point_t c2; return SqDist(seg1, seg2, c1, c2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t seg,
const Trajectory_t trj,
Point_t c1,
Point_t c2 
) const

LineSegment & Trajectory, keep track of points.

Definition at line 633 of file GeoAlgo.cxx.

References _SqDist_(), geoalgo::Trajectory::compat(), geoalgo::kMAX_DOUBLE, and geoalgo::LineSegment::Start().

634  {
635 
636  // Make sure trajectory object is properly defined
637  if (!trj.size())
638  throw GeoAlgoException("Trajectory object not properly set...");
639 
640  // Check dimensionality compatibility between point and trajectory
641  trj.compat(seg.Start());
642 
643  // keep track of c1 & c2
644  Point_t c1min;
645  Point_t c2min;
646  // Now keep track of smallest distance and loop over traj segments
647  double distMin = kMAX_DOUBLE;
648 
649  for (size_t l=0; l < trj.size()-1; l++){
650  LineSegment_t segTmp(trj[l], trj[l+1]);
651  double distTmp = _SqDist_(segTmp, seg, c1min, c2min);
652  if ( distTmp < distMin ){
653  c1 = c1min;
654  c2 = c2min;
655  distMin = distTmp;
656  }
657  }//for all segments in the track
658 
659  return distMin;
660  }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
LineSegment LineSegment_t
TCanvas * c2
Definition: plot_hist.C:75
static const double kMAX_DOUBLE
double geoalgo::GeoAlgo::SqDist ( const Trajectory_t trj,
const LineSegment_t seg,
Point_t c1,
Point_t c2 
) const
inline

LineSegment & Trajectory, keep track of points.

Definition at line 144 of file GeoAlgo.h.

References SqDist().

145  { return SqDist(seg, trj, c1, c2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const Trajectory_t trj,
const LineSegment_t seg 
) const
inline

LineSegment & Trajectory, don't keep track of points.

Definition at line 147 of file GeoAlgo.h.

References c1, c2, and SqDist().

148  { Point_t c1; Point_t c2; return SqDist(seg, trj, c1, c2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t seg,
const Trajectory_t trj 
) const
inline

LineSegment & Trajectory, don't keep track of points.

Definition at line 150 of file GeoAlgo.h.

References c1, c2, and SqDist().

151  { Point_t c1; Point_t c2; return SqDist(seg, trj, c1, c2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const Trajectory_t trj1,
const Trajectory_t trj2,
Point_t c1,
Point_t c2 
) const

Trajectory & Trajectory, keep track of points.

Definition at line 666 of file GeoAlgo.cxx.

References _SqDist_(), geoalgo::Trajectory::compat(), and geoalgo::kMAX_DOUBLE.

667  {
668 
669  // Make sure trajectory object is properly defined
670  if ( !trj1.size() or !trj2.size() )
671  throw GeoAlgoException("Trajectory object not properly set...");
672 
673  // Check dimensionality compatibility between point and trajectory
674  trj1.compat(trj2[0]);
675 
676  // keep track of c1 & c2
677  Point_t c1min;
678  Point_t c2min;
679  // Now keep track of smallest distance and loop over traj segments
680  double distMin = kMAX_DOUBLE;
681 
682  for (size_t l1=0; l1 < trj1.size()-1; l1++){
683  for (size_t l2=0; l2 < trj2.size()-1; l2++){
684  LineSegment_t segTmp1(trj1[l1], trj1[l1+1]);
685  LineSegment_t segTmp2(trj2[l2], trj2[l2+1]);
686  double distTmp = _SqDist_(segTmp1, segTmp2, c1min, c2min);
687  if ( distTmp < distMin ){
688  c1 = c1min;
689  c2 = c2min;
690  distMin = distTmp;
691  }
692  }// for segments in trajectory 2
693  }//for all segments in trajectory 1
694 
695  return distMin;
696  }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
LineSegment LineSegment_t
TCanvas * c2
Definition: plot_hist.C:75
static const double kMAX_DOUBLE
double geoalgo::GeoAlgo::SqDist ( const Trajectory_t trj1,
const Trajectory_t trj2 
) const
inline

Trajectory & Trajectory, don't keep track of points.

Definition at line 160 of file GeoAlgo.h.

References c1, c2, and SqDist().

161  { Point_t c1; Point_t c2; return SqDist(trj1, trj2, c1, c2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t seg,
const std::vector< geoalgo::Trajectory_t > &  trj,
Point_t c1,
Point_t c2,
int &  trackIdx 
) const

LineSegment & vector of Trajectories, keep track of points.

Definition at line 735 of file GeoAlgo.cxx.

References geoalgo::kMAX_DOUBLE, and SqDist().

736  {
737 
738  // holders to keep track of track with shortest distance
739  double minDist = kMAX_DOUBLE;
740  // holders for points of closest approach
741  Point_t c1min;
742  Point_t c2min;
743 
744  for (size_t t=0; t < trj.size(); t++){
745 
746  //need to loop over all tracks and find the one which is closest
747 
748  // dimensionality checks will be done in next function, per track.
749 
750  // now calculate closest approach
751  double tmpDist = SqDist(seg, trj[t], c1min, c2min);
752 
753  // is this the best yet?
754  if (tmpDist < minDist){
755  minDist = tmpDist;
756  c1 = c1min;
757  c2 = c2min;
758  trackIdx = t;
759  }
760 
761  }// for all tracks in vector
762 
763  return minDist;
764  }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
static const double kMAX_DOUBLE
double geoalgo::GeoAlgo::SqDist ( const std::vector< geoalgo::Trajectory_t > &  trj,
const LineSegment_t seg,
Point_t c1,
Point_t c2,
int &  trackIdx 
) const
inline

LineSegment & vector of Trajectories, keep track of points.

Definition at line 170 of file GeoAlgo.h.

References SqDist().

171  { return SqDist(seg, trj, c2, c1, trackIdx); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const std::vector< geoalgo::Trajectory_t > &  trj,
const LineSegment_t seg 
) const
inline

LineSegment & vector of Trajectories, don't keep track of points.

Definition at line 173 of file GeoAlgo.h.

References c1, c2, and SqDist().

174  { Point_t c1; Point_t c2; int trackIdx; return SqDist(seg, trj, c1, c2, trackIdx); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t seg,
const std::vector< geoalgo::Trajectory_t > &  trj 
) const
inline

LineSegment & vector of Trajectories, don't keep track of points.

Definition at line 176 of file GeoAlgo.h.

References c1, c2, and SqDist().

177  { Point_t c1; Point_t c2; int trackIdx; return SqDist(seg, trj, c1, c2, trackIdx); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const HalfLine_t hline,
const Trajectory_t trj,
Point_t c1,
Point_t c2 
) const

HalfLine & Trajectory, keep track of points.

Definition at line 701 of file GeoAlgo.cxx.

References _SqDist_(), geoalgo::Trajectory::compat(), geoalgo::kMAX_DOUBLE, and geoalgo::HalfLine::Start().

702  {
703 
704  // Make sure trajectory object is properly defined
705  if (!trj.size())
706  throw GeoAlgoException("Trajectory object not properly set...");
707 
708  // Check dimensionality compatibility between point and trajectory
709  trj.compat(hline.Start());
710 
711  // keep track of c1 & c2
712  Point_t c1min;
713  Point_t c2min;
714  // Now keep track of smallest distance and loop over traj segments
715  double distMin = kMAX_DOUBLE;
716 
717  for (size_t l=0; l < trj.size()-1; l++){
718  LineSegment_t segTmp(trj[l], trj[l+1]);
719  double distTmp = _SqDist_(hline, segTmp, c1min, c2min);
720  if ( distTmp < distMin ){
721  c1 = c1min;
722  c2 = c2min;
723  distMin = distTmp;
724  }
725  }//for all segments in the track
726 
727  return distMin;
728  }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
LineSegment LineSegment_t
TCanvas * c2
Definition: plot_hist.C:75
static const double kMAX_DOUBLE
double geoalgo::GeoAlgo::SqDist ( const Trajectory_t trj,
const HalfLine_t hline,
Point_t c1,
Point_t c2 
) const
inline

HalfLine & Trajectory, keep track of points.

Definition at line 186 of file GeoAlgo.h.

References SqDist().

187  { return SqDist(hline, trj, c2, c1); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const Trajectory_t trj,
const HalfLine_t hline 
) const
inline

HalfLine & Trajectory, don't keep track of points.

Definition at line 189 of file GeoAlgo.h.

References c1, c2, and SqDist().

190  { Point_t c1; Point_t c2; return SqDist(hline, trj, c1, c2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const HalfLine_t hline,
const Trajectory_t trj 
) const
inline

HalfLine & Trajectory, don't keep track of points.

Definition at line 192 of file GeoAlgo.h.

References c1, c2, pt, and SqDist().

193  { Point_t c1; Point_t c2; return SqDist(hline, trj, c1, c2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
double geoalgo::GeoAlgo::SqDist ( const Point_t pt,
const Trajectory_t trj 
) const

Point_t & Trajectory_t distance.

Definition at line 522 of file GeoAlgo.cxx.

References _SqDist_(), geoalgo::Trajectory::compat(), and geoalgo::kINVALID_DOUBLE.

523  {
524 
525  // Make sure trajectory object is properly defined
526  if (!trj.size())
527  throw GeoAlgoException("Trajectory object not properly set...");
528 
529  // Check dimensionality compatibility between point and trajectory
530  trj.compat(pt);
531 
532  // Now keep track of smallest distance and loop over traj segments
533  double distMin = kINVALID_DOUBLE;
534  for (size_t l=0; l < trj.size()-1; l++){
535  double distTmp = _SqDist_(pt,trj[l],trj[l+1]);
536  if (distTmp < distMin) { distMin = distTmp; }
537  }
538 
539  return distMin;
540  }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
static const double kINVALID_DOUBLE
double geoalgo::GeoAlgo::SqDist ( const Trajectory_t trj,
const Point_t pt 
) const
inline

Point_t & Trajectory_t distance.

Definition at line 202 of file GeoAlgo.h.

References SqDist().

203  { return SqDist(pt,trj); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const Point_t pt,
const std::vector< geoalgo::Trajectory_t > &  trj,
int &  trackIdx 
) const

Point_t & Trajectory_t distance - keep track of which track.

Definition at line 547 of file GeoAlgo.cxx.

References geoalgo::kINVALID_DOUBLE, and SqDist().

548  {
549 
550  // holder for shortest distance
551  double minDist = kINVALID_DOUBLE;
552 
553  // loop over trajectories
554  for (size_t t=0; t < trj.size(); t++){
555 
556  // trajectory & point dimensionality will be checked in next function
557  // now calculate distance w.r.t. this track
558  double tmpDist = SqDist(pt, trj[t]);
559  if (tmpDist < minDist){
560  minDist = tmpDist;
561  trackIdx = t;
562  }
563  }// for all tracks
564 
565  return minDist;
566  }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
static const double kINVALID_DOUBLE
double geoalgo::GeoAlgo::SqDist ( const std::vector< geoalgo::Trajectory_t > &  trj,
const Point_t pt,
int &  trackIdx 
) const
inline

Point_t & Trajectory_t distance - keep track of which track.

Definition at line 223 of file GeoAlgo.h.

References SqDist().

224  { return SqDist(pt,trj, trackIdx); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const Point_t pt,
const std::vector< geoalgo::Trajectory_t > &  trj 
) const
inline

Point_t & Trajectory_t distance - don't keep track.

Definition at line 226 of file GeoAlgo.h.

References SqDist().

227  { int trackIdx; return SqDist(pt, trj, trackIdx); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const std::vector< geoalgo::Trajectory_t > &  trj,
const Point_t pt 
) const
inline

Point_t & Trajectory_t distance - don't keep track.

Definition at line 229 of file GeoAlgo.h.

References ClosestPt(), and SqDist().

230  { int trackIdx; return SqDist(pt, trj, trackIdx); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const Point_t pt,
const LineSegment_t line 
) const
inline

Point & LineSegment_t distance.

Definition at line 248 of file GeoAlgo.h.

References _SqDist_(), geoalgo::Vector::compat(), and geoalgo::LineSegment::Start().

249  { pt.compat(line.Start()); return _SqDist_(pt,line); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t line,
const Point_t pt 
) const
inline

Point & LineSegment distance.

Definition at line 251 of file GeoAlgo.h.

References SqDist().

252  { return SqDist(pt,line); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const Point_t pt,
const HalfLine_t line 
) const
inline

Point & HalfLine distance.

Definition at line 264 of file GeoAlgo.h.

References _SqDist_(), geoalgo::Vector::compat(), and geoalgo::HalfLine::Start().

265  { pt.compat(line.Start()); return _SqDist_(pt,line); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const HalfLine_t line,
const Point_t pt 
) const
inline

Point & HalfLine distance.

Definition at line 267 of file GeoAlgo.h.

References SqDist().

268  { return SqDist(pt,line); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const HalfLine_t hline,
const LineSegment_t seg,
Point_t L1,
Point_t L2 
) const
inline

Definition at line 281 of file GeoAlgo.h.

References _SqDist_(), geoalgo::Vector::compat(), geoalgo::HalfLine::Start(), and geoalgo::LineSegment::Start().

282  { hline.Start().compat(seg.Start()); return _SqDist_(hline, seg, L1, L2); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t seg,
const HalfLine_t hline,
Point_t L1,
Point_t L2 
) const
inline

Definition at line 284 of file GeoAlgo.h.

References SqDist().

285  { return SqDist(hline,seg, L2, L1); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
double geoalgo::GeoAlgo::SqDist ( const HalfLine_t hline,
const LineSegment_t seg 
) const
inline

Definition at line 287 of file GeoAlgo.h.

References SqDist().

288  { Point_t L1; Point_t L2; return SqDist(hline, seg, L1, L2); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
recob::tracking::Point_t Point_t
double geoalgo::GeoAlgo::SqDist ( const LineSegment_t seg,
const HalfLine_t hline 
) const
inline

Definition at line 290 of file GeoAlgo.h.

References SqDist().

291  { return SqDist(hline,seg); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
double geoalgo::GeoAlgo::SqDist ( const Point_t pt,
const AABox_t box 
) const
inline

Point & AABox distance.

Definition at line 297 of file GeoAlgo.h.

References _SqDist_(), geoalgo::Vector::compat(), and geoalgo::AABox::Min().

298  { pt.compat(box.Min()); return _SqDist_(pt,box); }
double _SqDist_(const Line_t &l1, const Line_t &l2, Point_t &L1, Point_t &L2) const
Line & Line distance w/o dimensionality check.
Definition: GeoAlgo.cxx:192
TMarker * pt
Definition: egs.C:25
double geoalgo::GeoAlgo::SqDist ( const AABox_t box,
const Point_t pt 
)
inline

Point & AABox distance.

Definition at line 300 of file GeoAlgo.h.

References SqDist().

301  { return SqDist(pt,box); }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:92
TMarker * pt
Definition: egs.C:25

The documentation for this class was generated from the following files: