23 #ifndef LSST_SPHGEOM_UNITVECTOR3D_H_ 24 #define LSST_SPHGEOM_UNITVECTOR3D_H_ 145 double x()
const {
return _v.
x(); }
147 double y()
const {
return _v.
y(); }
149 double z()
const {
return _v.
z(); }
162 return (v + *
this).
cross(v - *
this);
167 UnitVector3d u; u._v = -_v;
return u;
206 #endif // LSST_SPHGEOM_UNITVECTOR3D_H_ double normalize()
normalize scales this vector to have unit norm and returns its norm prior to scaling.
Vector3d cwiseProduct(Vector3d const &v) const
cwiseProduct returns the component-wise product of this vector and v.
static UnitVector3d orthogonalTo(Vector3d const &v)
orthogonalTo returns an arbitrary unit vector that is orthogonal to v.
NormalizedAngle is an angle that lies in the range [0, 2π), with one exception - a NormalizedAngle ca...
Vector3d operator*(double s) const
The multiplication operator returns the component-wise product of this unit vector with scalar s...
UnitVector3d rotatedAround(UnitVector3d const &k, Angle a) const
rotatedAround returns a copy of this unit vector, rotated around the unit vector k by angle a accordi...
std::ostream & operator<<(std::ostream &, Angle const &)
static UnitVector3d northFrom(Vector3d const &v)
northFrom returns the unit vector orthogonal to v that points "north" from v.
Vector3d rotatedAround(UnitVector3d const &k, Angle a) const
rotatedAround returns a copy of this vector, rotated around the unit vector k by angle a according to...
static UnitVector3d orthogonalTo(NormalizedAngle const &a)
orthogonalTo returns the unit vector orthogonal to the meridian with the given longitude.
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 sin(Angle const &a)
NormalizedAngle getLon() const
double cos(Angle const &a)
This file declares a class for representing vectors in ℝ³.
Vector3d operator+(Vector3d const &v) const
The addition operator returns the sum of this unit vector and v.
bool operator==(Vector3d const &v) const
Vector3d cross(Vector3d const &v) const
cross returns the cross product of this unit vector and v.
A base class for image defects.
Vector3d operator-(Vector3d const &v) const
The subtraction operator returns the difference between this unit vector and v.
UnitVector3d(UnitVector3d const &v)
Vector3d cwiseProduct(Vector3d const &v) const
cwiseProduct returns the component-wise product of this unit vector and v.
double const * getData() const
getData returns a pointer to the 3 components of this unit vector.
UnitVector3d(double x, double y, double z)
Angle represents an angle in radians.
static UnitVector3d fromNormalized(double x, double y, double z)
fromNormalized returns the unit vector with the given components, which are assumed to correspond to ...
LonLat represents a spherical coordinate (longitude/latitude angle) pair.
Vector3d cross(Vector3d const &v) const
cross returns the cross product of this vector and v.
bool operator!=(Vector3d const &v) const
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
Vector3d operator/(double s) const
The division operator returns the component-wise quotient of this unit vector with scalar s...
double dot(Vector3d const &v) const
dot returns the inner product of this unit vector and v.
double operator()(int i) const
The function call operator returns the i-th component of this vector.
This file contains a class representing spherical coordinates.
static UnitVector3d fromNormalized(Vector3d const &v)
fromNormalized returns the unit vector equal to v, which is assumed to be normalized.
UnitVector3d(Vector3d const &v)
UnitVector3d operator-() const
The unary minus operator negates every component of this unit vector.
double const * getData() const
data returns a pointer to the 3 components of this vector.
double dot(Vector3d const &v) const
dot returns the inner product of this vector and v.
UnitVector3d(LonLat const &p)
This constructor creates the unit vector corresponding to the point p on the unit sphere...
UnitVector3d()
The default constructor creates a unit vector equal to (1, 0, 0).