2 #include <utl/AxialVector.h>
3 #include <utl/GeometryUtilities.h>
4 #include <utl/MathConstants.h>
5 #include <utl/ReferenceEllipsoid.h>
7 #include <utl/CoordinateSystemPtr.h>
8 #include <utl/PhysicalConstants.h>
24 const double n1b = n1 *
b;
25 const double n2b = n2 *
b;
26 const double nn = n1 * n2;
27 const double det = 1 -
Sqr(nn);
28 const double alpha = (nn*n2b + n1b) / det;
29 const double beta = - (nn*n1b + n2b) / det;
30 const Point anch = a1 - b + alpha*n1 + beta*n2;
33 return Line(anch, dir);
43 return al - ((n*(al - plane.
GetAnchor())) / (n*dir)) * dir;
55 const double alpha2 =
Sqr(alpha);
56 const double beta2 =
Sqr(beta);
58 const auto& csECEF = CoordinateSystem::GetRootCoordinateSystem();
62 const auto uvw = direction.GetCoordinates(csECEF);
63 const double& u = uvw.get<0>();
64 const double& v = uvw.get<1>();
65 const double& w = uvw.get<2>();
69 const auto xyz = anchor.GetCoordinates(csECEF);
70 const double& x = xyz.get<0>();
71 const double& y = xyz.get<1>();
72 const double& z = xyz.get<2>();
75 const double a = (
Sqr(u) +
Sqr(v))*alpha2 +
Sqr(w*beta);
76 const double b = (x*u + y*v)*alpha2 + z*w*beta2;
77 const double c = (
Sqr(x) +
Sqr(y))*alpha2 + (
Sqr(z) - alpha2)*beta2;
80 const double ba = -b/
a;
81 const double dis =
Sqr(ba) - c/
a;
83 vector<Point> intersectionPoints;
90 intersectionPoints.push_back(anchor + ba*direction);
95 const double sdis =
sqrt(dis);
98 intersectionPoints.push_back(anchor + (ba + sdis)*direction);
100 intersectionPoints.push_back(anchor + (ba - sdis)*direction);
104 return intersectionPoints;
115 const double norm2 = n.
GetMag2();
AxialVector Cross(const Vector &l, const Vector &r)
constexpr T Sqr(const T &x)
const Point & GetAnchor() const
Line Intersection(const Plane &p1, const Plane &p2)
Reference ellipsoids for UTM transformations.
Class describing a Plane object.
double GetEquatorialRadius() const
Get equatorial radius ( )
double GetPolarRadius() const
Get Polar radius ( )
double Distance(const Point &p, const sdet::Station &s)
const Vector & GetDirection() const
const Point & GetAnchor() const
const Vector & GetNormal() const
Predicate for approximate equality (for floating point)