23 #ifndef LSST_SPHGEOM_VECTOR3D_H_ 24 #define LSST_SPHGEOM_VECTOR3D_H_ 47 Vector3d() { _v[0] = 0.0; _v[1] = 0.0; _v[2] = 0.0; }
53 return _v[0] == v._v[0] && _v[1] == v._v[1] && _v[2] == v._v[2];
57 return _v[0] != v._v[0] || _v[1] != v._v[1] || _v[2] != v._v[2];
61 double const *
getData()
const {
return _v; }
66 double x()
const {
return _v[0]; }
68 double y()
const {
return _v[1]; }
70 double z()
const {
return _v[2]; }
74 return _v[0] * v._v[0] + _v[1] * v._v[1] + _v[2] * v._v[2];
102 return Vector3d(_v[1] * v._v[2] - _v[2] * v._v[1],
103 _v[2] * v._v[0] - _v[0] * v._v[2],
104 _v[0] * v._v[1] - _v[1] * v._v[0]);
171 #endif // LSST_SPHGEOM_VECTOR3D_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.
bool isNormalized() const
isNormalized returns true if this vectors norm is very close to 1.
Vector3d()
The default constructor creates a zero vector.
bool operator!=(Vector3d const &v) const
Vector3d & operator+=(Vector3d const &v)
std::ostream & operator<<(std::ostream &, Angle const &)
Vector3d operator*(double s) const
The multiplication operator returns the component-wise product of this vector with scalar s...
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...
double operator()(int i) const
The function call operator returns the i-th component of this vector.
Vector3d is a vector in ℝ³ with components stored in double precision.
bool operator==(Vector3d const &v) const
A base class for image defects.
Vector3d & operator/=(double s)
bool isZero() const
isZero returns true if all the components of this vector are zero.
Vector3d operator-() const
The unary minus operator negates every component of this vector.
Angle represents an angle in radians.
Vector3d operator+(Vector3d const &v) const
The addition operator returns the sum of this vector and v.
Vector3d cross(Vector3d const &v) const
cross returns the cross product of this vector and v.
Vector3d & operator*=(double s)
Vector3d operator-(Vector3d const &v) const
The subtraction operator returns the difference between this vector and v.
Vector3d(double x, double y, double z)
This constructor creates a vector with the given components.
Vector3d & operator-=(Vector3d const &v)
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
double getSquaredNorm() const
getSquaredNorm returns the inner product of this vector with itself.
Vector3d operator/(double s) const
The division operator returns the component-wise quotient of this vector with scalar s...
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.
double getNorm() const
getNorm returns the L2 norm of this vector.