#include <Doca.h>
Public Member Functions | |
| Doca (const Ray &ray1, const Ray &ray2=nullRay) | |
| Doca (const Point &point1, const Vector &vector1, const Point &point2=p_nullRay, const Vector &vector2=v_nullRay) | |
| ~Doca () | |
| double | docaRay1Ray2 () |
| return doca between two Rays | |
| double | arcLenRay1 () |
| return distance of doca from origin of 1st Ray | |
| double | arcLenRay2 () |
| return distance of doca from origin of 2nd Ray | |
| Point | docaPointRay1 () |
| point of doca on 1st Ray | |
| Point | docaPointRay2 () |
| point of doca on 2nd Ray | |
| double | docaOfPoint (const Point &p) |
| doca of a point to the first line | |
Private Types | |
| enum | mode { LINELINE, LINEPOINT } |
Private Member Functions | |
| void | ini () |
Private Attributes | |
| Point | P |
| origin of 1st Ray | |
| Vector | u |
| direction of 1st Ray | |
| Point | Q |
| origin of 2nd Ray | |
| Vector | v |
| direction of 2nd Ray | |
| double | doca |
| DOCA between the two Rays. | |
| double | s |
| distance of DOCA point from origin 1 | |
| double | t |
| distance of DOCA point from origin 2 | |
| mode | m_mode |
| mode of doca call, either 2 lines or a line and a point | |
| Point | p1 |
| storage for point in LINEPOINT mode | |
A utility for calculating the distance of closest approach between two (assumed straight) tracks and the point on each line where this occurs.
Also can do the distance between a line and a point
The method is taken from "Distance between Lines and Segments with their Closest Point of Approach" found at http://www.geometryalgorithms.com/Archive/algorithm_0106/algorithm_0106.htm
Definition at line 34 of file Doca.h.
|
|
Definition at line 58 of file Doca.h.
|
|
||||||||||||
|
Definition at line 15 of file Doca.cxx. References ini().
|
|
||||||||||||||||||||
|
Definition at line 24 of file Doca.cxx. References ini().
|
|
|
Definition at line 40 of file Doca.h.
00040 {}
|
|
|
return distance of doca from origin of 1st Ray
Definition at line 45 of file Doca.h. References s. Referenced by VtxValsTool::calculate(), and TkrValsTool::calculate().
00045 {return s;}
|
|
|
return distance of doca from origin of 2nd Ray
Definition at line 47 of file Doca.h. References t.
00047 {return t;}
|
|
|
doca of a point to the first line
Definition at line 86 of file Doca.cxx. Referenced by VtxValsTool::calculate(), TkrValsTool::calculate(), and CalValsTool::calculate().
|
|
|
point of doca on 1st Ray
Definition at line 74 of file Doca.cxx.
|
|
|
point of doca on 2nd Ray
Definition at line 79 of file Doca.cxx. References LINEPOINT, m_mode, Q, t, and v.
|
|
|
return doca between two Rays
Definition at line 43 of file Doca.h. References doca.
00043 {return doca;}
|
|
|
Definition at line 32 of file Doca.cxx. References doca, LINELINE, LINEPOINT, m_mode, P, Q, s, t, u, and v. Referenced by Doca().
00032 {
00033
00034 u = u.unit();
00035
00036 m_mode = LINELINE;
00037 if(v.mag()==0.0) {
00038 m_mode = LINEPOINT;
00039 return;
00040 }
00041
00042 v = v.unit();
00043
00044 //Determine vector from start point track 1 to start of track 2
00045 Vector w = P - Q;
00046
00047 //Projections of of tracks along vector between start points
00048 double d = u.dot(w);
00049 double e = v.dot(w);
00050
00051 //Dot product between two tracks to check if parallel
00052 double b = u.dot(v);
00053 double denom = 1. - b*b;
00054
00055 //Lines are not parallel
00056 if (fabs(b) < 1.)
00057 {
00058 s = (b*e - d ) / denom;
00059 t = (e - b*d) / denom;
00060 w = w + s * u - t * v;
00061 doca = w.magnitude();
00062 }
00063 //Lines are parallel
00064 else
00065 {
00066 s = 0;
00067 t = d / b;
00068 w = w - t * v;
00069 doca = w.magnitude();
00070 }
00071 }
|
|
|
DOCA between the two Rays.
Definition at line 68 of file Doca.h. Referenced by docaRay1Ray2(), and ini(). |
|
|
mode of doca call, either 2 lines or a line and a point
Definition at line 74 of file Doca.h. Referenced by docaPointRay2(), and ini(). |
|
|
origin of 1st Ray
Definition at line 60 of file Doca.h. Referenced by docaOfPoint(), docaPointRay1(), and ini(). |
|
|
storage for point in LINEPOINT mode
Definition at line 76 of file Doca.h. Referenced by docaOfPoint(). |
|
|
origin of 2nd Ray
Definition at line 64 of file Doca.h. Referenced by docaPointRay2(), and ini(). |
|
|
distance of DOCA point from origin 1
Definition at line 70 of file Doca.h. Referenced by arcLenRay1(), docaOfPoint(), docaPointRay1(), and ini(). |
|
|
distance of DOCA point from origin 2
Definition at line 72 of file Doca.h. Referenced by arcLenRay2(), docaPointRay2(), and ini(). |
|
|
direction of 1st Ray
Definition at line 62 of file Doca.h. Referenced by docaOfPoint(), docaPointRay1(), and ini(). |
|
|
direction of 2nd Ray
Definition at line 66 of file Doca.h. Referenced by docaPointRay2(), and ini(). |
1.3.3