42 if (vxn.
dot(a) > 0.0 && vxn.
dot(b) < 0.0) {
51 double theta = (c == 0.0) ? 0.5 *
PI :
std::atan(s / c);
64 if (vxn.
dot(a) < 0.0 && vxn.
dot(b) > 0.0) {
97 double c01 = v0.
dot(v1);
98 double c12 = v1.
dot(v2);
99 double c20 = v2.
dot(v0);
100 double a0 = (s12 == 0.0 && c12 == 0.0) ? 0.0 :
std::atan2(s12, c12);
101 double a1 = (s20 == 0.0 && c20 == 0.0) ? 0.0 :
std::atan2(s20, c20);
102 double a2 = (s01 == 0.0 && c01 == 0.0) ? 0.0 :
std::atan2(s01, c01);
103 return 0.5 * (x01 * a2 + x12 * a0 + x20 * a1);
double normalize()
normalize scales this vector to have unit norm and returns its norm prior to scaling.
Vector3d robustCross(UnitVector3d const &v) const
a.robustCross(b) is (b + a).cross(b - a) - twice the cross product of a and b.
Vector3d is a vector in ℝ³ with components stored in double precision.
double getMinSquaredChordLength(Vector3d const &v, Vector3d const &a, Vector3d const &b, Vector3d const &n)
Let p be the unit vector closest to v that lies on the plane with normal n in the direction of the cr...
This file declares a class for representing unit vectors in ℝ³.
Vector3d getWeightedCentroid(UnitVector3d const &v0, UnitVector3d const &v1, UnitVector3d const &v2)
getWeightedCentroid returns the center of mass of the given spherical triangle (assuming a uniform ma...
A base class for image defects.
This file declares miscellaneous utility functions.
double getMaxSquaredChordLength(Vector3d const &v, Vector3d const &a, Vector3d const &b, Vector3d const &n)
Let p be the unit vector furthest from v that lies on the plane with normal n in the direction of the...
Vector3d cross(Vector3d const &v) const
cross returns the cross product of this vector and v.
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
double dot(Vector3d const &v) const
dot returns the inner product of this unit vector and v.
double dot(Vector3d const &v) const
dot returns the inner product of this vector and v.
double getNorm() const
getNorm returns the L2 norm of this vector.