lsst.sphgeom 22.0.1-8-gfb2c8f9+f3d053c481
|
This file contains the orientation function implementations. More...
Functions | |
int | lsst::sphgeom::orientationExact (Vector3d const &a, Vector3d const &b, Vector3d const &c) |
int | lsst::sphgeom::orientation (UnitVector3d const &a, UnitVector3d const &b, UnitVector3d const &c) |
int | lsst::sphgeom::orientationX (UnitVector3d const &b, UnitVector3d const &c) |
orientationX(b, c) is equivalent to orientation(UnitVector3d::X(), b, c) . | |
int | lsst::sphgeom::orientationY (UnitVector3d const &b, UnitVector3d const &c) |
orientationY(b, c) is equivalent to orientation(UnitVector3d::Y(), b, c) . | |
int | lsst::sphgeom::orientationZ (UnitVector3d const &b, UnitVector3d const &c) |
orientationZ(b, c) is equivalent to orientation(UnitVector3d::Z(), b, c) . | |
This file contains the orientation function implementations.
int lsst::sphgeom::orientation | ( | UnitVector3d const & | a, |
UnitVector3d const & | b, | ||
UnitVector3d const & | c | ||
) |
orientation
computes and returns the orientations of 3 unit vectors a, b and c. The return value is +1 if the vectors are in counter-clockwise orientation, 0 if they are coplanar, colinear or identical, and -1 if they are in clockwise orientation.
This is equivalent to computing the sign of the scalar triple product a ยท (b x c), which is the sign of the determinant of the 3x3 matrix with a, b and c as columns/rows.
The implementation proceeds by first computing a double precision approximation, and then falling back to arbitrary precision arithmetic when necessary. Consequently, the result is exact.
orientationExact
computes and returns the orientations of 3 vectors a, b and c, which need not be normalized but are assumed to have finite components. The return value is +1 if the vectors a, b, and c are in counter-clockwise orientation, 0 if they are coplanar, colinear, or identical, and -1 if they are in clockwise orientation. The implementation uses arbitrary precision arithmetic to avoid floating point rounding error, underflow and overflow.