A 3D double vector. More...
#include <Vec3d.h>
Public Member Functions | |
Vec3d () noexcept | |
Construct 0 vector. | |
Vec3d (double a, double b, double c) noexcept | |
Construct vector. | |
Vec3d (double a) noexcept | |
Construct vector where all coords = a. | |
Vec3d (const Vec3i &v) noexcept | |
Convert from int vector. | |
Vec3d (const Vec3usi &v) noexcept | |
Construct from a 3D unsigned int vector. | |
Vec3d (const Vec3f &v) noexcept | |
Convert from float vector. | |
![]() | |
ArithVec3Float (doublea, doubleb, doublec) noexcept | |
Construct a 3D float vector. | |
ArithVec3Float () noexcept | |
Construct a 3D float vector. | |
void | get_spherical (double &, double &, double &) const |
void | set_spherical (double, double, double) |
![]() | |
ArithVecFloat (doublea) noexcept | |
ArithVecFloat (doublea, doubleb) noexcept | |
ArithVecFloat (doublea, doubleb, doublec) noexcept | |
ArithVecFloat (doublea, doubleb, doublec, doubled) noexcept | |
double | length () const |
Compute Euclidean length. | |
void | normalize () |
Normalize vector. | |
void | cond_normalize () |
Conditionally normalize vector. The condition being that the vector has non-zero length. | |
![]() | |
void | set (double_a, double_b) |
Set all coordinates of a 2D vector. | |
void | set (double_a, double_b, double_c) |
Set all coordinates of a 3D vector. | |
void | set (double_a, double_b, double_c, double_d) |
Set all coordinates of a 4D vector. | |
const double & | operator[] (unsigned int i) const |
Const index operator. | |
double & | operator[] (unsigned int i) |
Non-const index operator. | |
const double & | operator() (unsigned int i) const |
Const index operator. | |
double & | operator() (unsigned int i) |
Non-const index operator. | |
double * | get () |
const double * | get () const |
bool | operator== (const Vec3d &v) const |
Equality operator. | |
bool | operator== (doublek) const |
Equality wrt scalar. True if all coords are equal to scalar. | |
bool | operator!= (const Vec3d &v) const |
Inequality operator. | |
bool | operator!= (doublek) const |
Inequality wrt scalar. True if any coord not equal to scalar. | |
bool | all_l (const Vec3d &v) const |
bool | all_le (const Vec3d &v) const |
bool | all_g (const Vec3d &v) const |
bool | all_ge (const Vec3d &v) const |
const Vec3d & | operator*= (doublek) |
Assignment multiplication with scalar. | |
const Vec3d & | operator*= (const Vec3d &v) |
const Vec3d & | operator/= (doublek) |
Assignment division with scalar. | |
const Vec3d & | operator/= (const Vec3d &v) |
Assigment division with vector. Each coord divided independently. | |
const Vec3d & | operator+= (doublek) |
Assignment addition with scalar. Adds scalar to each coordinate. | |
const Vec3d & | operator+= (const Vec3d &v) |
Assignmment addition with vector. | |
const Vec3d & | operator-= (doublek) |
Assignment subtraction with scalar. Subtracts scalar from each coord. | |
const Vec3d & | operator-= (const Vec3d &v) |
Assignment subtraction with vector. | |
const Vec3d | operator- () const |
Negate vector. | |
const Vec3d | operator- (const Vec3d &v1) const |
Subtract two vectors. | |
const Vec3d | operator* (const Vec3d &v1) const |
const Vec3d | operator* (doublek) const |
Multiply scalar onto vector. | |
const Vec3d | operator+ (const Vec3d &v1) const |
Add two vectors. | |
const Vec3d | operator/ (const Vec3d &v1) const |
Divide two vectors. Each coord separately. | |
const Vec3d | operator/ (doublek) const |
Divide vector by scalar. | |
const double | min_coord () const |
Return the smallest coordinate of the vector. | |
const double | max_coord () const |
Return the largest coordinate of the vector. | |
Additional Inherited Members | |
![]() | |
typedef double | ScalarType |
For convenience we define a more meaningful name for the scalar type. | |
typedef Vec3d | VectorType |
A more meaningful name for vector type. | |
![]() | |
static unsigned int | get_dim () |
Return dimension of vector. | |
![]() | |
ArithVec () | |
Construct uninitialized vector. | |
ArithVec (double_a) | |
Construct a vector where all coordinates are identical. | |
ArithVec (double_a, double_b) | |
Construct a 2D vector. | |
ArithVec (double_a, double_b, double_c) | |
Construct a 3D vector. | |
ArithVec (double_a, double_b, double_c, double_d) | |
Construct a 4D vector. | |
![]() | |
double | data [N] |
The actual contents of the vector. | |
A 3D double vector.
Useful for high precision arithmetic.