lsst.sphgeom  21.0.0+d529cf1a41
Public Member Functions | List of all members
lsst::sphgeom::Vector3d Class Reference

Vector3d is a vector in ℝ³ with components stored in double precision. More...

#include <Vector3d.h>

Public Member Functions

 Vector3d ()
 The default constructor creates a zero vector.
 
 Vector3d (double x, double y, double z)
 This constructor creates a vector with the given components.
 
bool operator== (Vector3d const &v) const
 
bool operator!= (Vector3d const &v) const
 
double const * getData () const
 data returns a pointer to the 3 components of this vector.
 
double operator() (int i) const
 The function call operator returns the i-th component of this vector.
 
double x () const
 
double y () const
 
double z () const
 
double dot (Vector3d const &v) const
 dot returns the inner product of this vector and v.
 
double getSquaredNorm () const
 getSquaredNorm returns the inner product of this vector with itself.
 
double getNorm () const
 getNorm returns the L2 norm of this vector.
 
bool isZero () const
 isZero returns true if all the components of this vector are zero.
 
double normalize ()
 
bool isNormalized () const
 isNormalized returns true if this vectors norm is very close to 1.
 
Vector3d cross (Vector3d const &v) const
 cross returns the cross product of this vector and v.
 
Vector3d operator- () const
 The unary minus operator negates every component of this vector.
 
Vector3d operator* (double s) const
 
Vector3d operator/ (double s) const
 
Vector3d operator+ (Vector3d const &v) const
 The addition operator returns the sum of this vector and v.
 
Vector3d operator- (Vector3d const &v) const
 The subtraction operator returns the difference between this vector and v.
 
Vector3doperator*= (double s)
 
Vector3doperator/= (double s)
 
Vector3doperator+= (Vector3d const &v)
 
Vector3doperator-= (Vector3d const &v)
 
Vector3d cwiseProduct (Vector3d const &v) const
 cwiseProduct returns the component-wise product of this vector and v.
 
Vector3d rotatedAround (UnitVector3d const &k, Angle a) const
 

Detailed Description

Vector3d is a vector in ℝ³ with components stored in double precision.

Member Function Documentation

◆ normalize()

double lsst::sphgeom::Vector3d::normalize ( )

normalize scales this vector to have unit norm and returns its norm prior to scaling. It will accurately normalize any vector with finite components except for (0, 0, 0), including those with norms that overflow. Trying to normalize (0, 0, 0) will cause a std::runtime_error to be thrown.

◆ operator*()

Vector3d lsst::sphgeom::Vector3d::operator* ( double  s) const
inline

The multiplication operator returns the component-wise product of this vector with scalar s.

◆ operator/()

Vector3d lsst::sphgeom::Vector3d::operator/ ( double  s) const
inline

The division operator returns the component-wise quotient of this vector with scalar s.

◆ rotatedAround()

Vector3d lsst::sphgeom::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 the right hand rule.


The documentation for this class was generated from the following files: