CellModules
|
general purpose 3D vector/point class. More...
#include <vector3D.h>
Public Member Functions | |
Vector3D (double a, double b, double c) | |
Vector3D () | |
Vector3D (double a) | |
Vector3D (std::array< double, 3 > c) | |
Vector3D (const Vector3D &v) | |
Vector3D (Vector3D &&v) | |
Vector3D & | operator= (const Vector3D &other) |
assignment operator for copy constructing a vector More... | |
double | dot (const Vector3D &v) const |
dot product calculation More... | |
const Vector3D | cross (const Vector3D &v) const |
cross product calculation More... | |
double & | xRef () |
double & | yRef () |
double & | zRef () |
double | x () const |
double | y () const |
double | z () const |
void | setX (const double f) |
setter for x coordinate More... | |
void | setY (const double f) |
setter for y coordinate More... | |
void | setZ (const double f) |
setter for z coordinate More... | |
void | random () |
sets the current vector as a random normalized one. Uniform direction distribution on all directions of a sphere. More... | |
Vector3D | deltaDirection (double amount) |
returns a vector randomly tilted relatively to the original one More... | |
bool | isZero () const |
returns true if all vector coordinates are equal to zero More... | |
Vector3D & | operator*= (double d) |
scalar multiplication operator More... | |
Vector3D & | operator/= (double d) |
scalar division operator More... | |
Vector3D & | operator+= (const Vector3D &v) |
addition operator More... | |
Vector3D & | operator-= (const Vector3D &v) |
substract operator More... | |
double | length () const |
compute the length of the vector More... | |
double | sqlength () const |
compute the square length of the current vector (faster than length) More... | |
Vector3D | rotated (double angle, const Vector3D &vec) const |
gives a rotated copy of the current vector More... | |
Vector3D | rotated (const Rotation< Vector3D > &r) const |
gives a rotated copy of the current vector More... | |
void | normalize () |
normalizes the vector More... | |
Vector3D | normalized () const |
returns a normalized copy of the current vector More... | |
std::string | toString () const |
int | getHash (const int a, const int b) const |
fast hash for two ints More... | |
int | getHash () const |
fast hash method More... | |
void | iterateTo (const Vector3D &v, const std::function< void(const Vector3D &)> &fun, const double inc=1) const |
helper method to iterates over a 3D rectangular cuboid bounded by two corner vectors More... | |
Vector3D | ortho () const |
deterministic generation of an orthogonal vector More... | |
Vector3D | ortho (const Vector3D &v) const |
EXPORTABLE (Vector3D, KV(coords)) | |
Static Public Member Functions | |
static Vector3D | randomUnit () |
creates a random normalized vector. Uniform direction distribution on all directions of a sphere. More... | |
static Vector3D | zero () |
constructs a zero vector More... | |
static void | addAsAngularVelocity (const Vector3D &v, Rotation< Vector3D > &r) |
adds a vector representing an angular Velocity (or any rotation coded on only one vector) to an existing rotation More... | |
static Rotation< Vector3D > | getRotation (const Vector3D &v0, const Vector3D &v1) |
computes the rotation from one vector to another More... | |
static double | rayCast (const Vector3D &o, const Vector3D &n, const Vector3D &p, const Vector3D &r) |
simple raycasting on a plane More... | |
static Vector3D | getProjectionOnPlane (const Vector3D &o, const Vector3D &n, const Vector3D &p) |
project a point on a plane More... | |
static Rotation< Vector3D > | rotateRotation (const Rotation< Vector3D > &start, const Rotation< Vector3D > &offset) |
rotates the axis of rotation of a rotation More... | |
static Rotation< Vector3D > | addRotations (const Rotation< Vector3D > &R0, const Rotation< Vector3D > &R1) |
adds two rotations More... | |
static Rotation< Vector3D > | getRotation (const Vector3D &X0, const Vector3D &Y0, const Vector3D &X1, const Vector3D &Y1) |
computes the rotation transform from basis X0,Y0 to X1,Y1 More... | |
static Rotation< Vector3D > | getRotation (const Basis< Vector3D > &b0, const Basis< Vector3D > &b1) |
computes the rotation transform from basis b0 to b1 More... | |
static Vector3D | getProjection (const Vector3D &A, const Vector3D &B, const Vector3D &P) |
computes the orthogonal projection of a point onto a segment AB More... | |
Public Attributes | |
std::array< double, 3 > | coords |
Static Public Attributes | |
static const int | dimension = 3 |
Friends | |
bool | operator== (const Vector3D &v1, const Vector3D &v2) |
bool | operator!= (const Vector3D &v1, const Vector3D &v2) |
Vector3D | operator+ (const Vector3D &v1, const Vector3D &v2) |
Vector3D | operator+ (const Vector3D &v1, double f) |
Vector3D | operator+ (double f, const Vector3D &v1) |
Vector3D | operator- (const Vector3D &v1, const Vector3D &v2) |
Vector3D | operator- (const Vector3D &v1, double f) |
Vector3D | operator- (double f, const Vector3D &v1) |
Vector3D | operator* (double factor, const Vector3D &vector) |
Vector3D | operator* (const Vector3D &vector, double factor) |
Vector3D | operator* (const Vector3D &v1, const Vector3D &v2) |
Vector3D | operator- (const Vector3D &vector) |
Vector3D | operator/ (const Vector3D &vector, double divisor) |
ostream & | operator<< (ostream &out, const Vector3D &v) |
general purpose 3D vector/point class.
Definition at line 20 of file vector3D.h.
|
inline |
Definition at line 25 of file vector3D.h.
|
inline |
Definition at line 28 of file vector3D.h.
|
inlineexplicit |
Definition at line 29 of file vector3D.h.
|
inlineexplicit |
Definition at line 30 of file vector3D.h.
|
inline |
Definition at line 31 of file vector3D.h.
|
inline |
Definition at line 32 of file vector3D.h.
|
inlinestatic |
adds a vector representing an angular Velocity (or any rotation coded on only one vector) to an existing rotation
v | the single vector coded rotation (its length codes for the angle) |
r | the rotation which is going to be modified |
Definition at line 305 of file vector3D.h.
cross product calculation
v | a Vector3D |
Definition at line 65 of file vector3D.h.
|
inline |
returns a vector randomly tilted relatively to the original one
amount | the width of the normal distribution |
Definition at line 157 of file vector3D.h.
|
inline |
dot product calculation
v | a Vector3D |
Definition at line 54 of file vector3D.h.
|
inline |
|
inline |
|
inlinestatic |
computes the orthogonal projection of a point onto a segment AB
A | the origin of the segment |
B | the endpoint of the segment |
P | the point to be projected |
Definition at line 437 of file vector3D.h.
|
inlinestatic |
project a point on a plane
o | a point in the plane |
n | the plane's normal |
p | the point to be projected onto the surface of the plane |
Definition at line 362 of file vector3D.h.
|
inlinestatic |
computes the rotation transform from basis b0 to b1
X0 | |
Y0 | |
X1 | |
Y1 |
Definition at line 423 of file vector3D.h.
|
inlinestatic |
computes the rotation from one vector to another
v0 | first vector |
v1 | second vector |
Definition at line 322 of file vector3D.h.
|
inlinestatic |
computes the rotation transform from basis X0,Y0 to X1,Y1
X0 | |
Y0 | |
X1 | |
Y1 |
Definition at line 404 of file vector3D.h.
|
inline |
returns true if all vector coordinates are equal to zero
Definition at line 177 of file vector3D.h.
|
inline |
helper method to iterates over a 3D rectangular cuboid bounded by two corner vectors
v | the upper bound corner (lower bound is the current vector) |
fun | a function taking the upper bound vector as well as an increent (default = 1.0) |
inc | the increment step |
Definition at line 498 of file vector3D.h.
|
inline |
|
inline |
normalizes the vector
Definition at line 445 of file vector3D.h.
|
inline |
|
inline |
|
inline |
assignment operator for copy constructing a vector
other |
Definition at line 41 of file vector3D.h.
|
inline |
Definition at line 526 of file vector3D.h.
|
inline |
sets the current vector as a random normalized one. Uniform direction distribution on all directions of a sphere.
Definition at line 131 of file vector3D.h.
|
inlinestatic |
creates a random normalized vector. Uniform direction distribution on all directions of a sphere.
Definition at line 144 of file vector3D.h.
|
inlinestatic |
simple raycasting on a plane
o | a point in the plane |
n | normal of the plane |
p | origin of the ray |
r | direction of the ray |
Definition at line 346 of file vector3D.h.
gives a rotated copy of the current vector
r | the rotation |
Definition at line 291 of file vector3D.h.
gives a rotated copy of the current vector
angle | the rotation angle in radians |
vec | the axis of rotation |
Definition at line 277 of file vector3D.h.
|
inlinestatic |
rotates the axis of rotation of a rotation
start | |
offset |
Definition at line 375 of file vector3D.h.
|
inline |
|
inline |
|
inline |
|
inline |
compute the square length of the current vector (faster than length)
Definition at line 265 of file vector3D.h.
|
inline |
Definition at line 457 of file vector3D.h.
|
inline |
Definition at line 94 of file vector3D.h.
|
inline |
Definition at line 76 of file vector3D.h.
|
inline |
Definition at line 100 of file vector3D.h.
|
inline |
Definition at line 82 of file vector3D.h.
|
inline |
Definition at line 106 of file vector3D.h.
|
inlinestatic |
|
inline |
Definition at line 88 of file vector3D.h.
Definition at line 541 of file vector3D.h.
Definition at line 561 of file vector3D.h.
Definition at line 569 of file vector3D.h.
Definition at line 566 of file vector3D.h.
Definition at line 546 of file vector3D.h.
Definition at line 553 of file vector3D.h.
Definition at line 550 of file vector3D.h.
Definition at line 557 of file vector3D.h.
Definition at line 576 of file vector3D.h.
Definition at line 580 of file vector3D.h.
Definition at line 573 of file vector3D.h.
Definition at line 584 of file vector3D.h.
|
friend |
Definition at line 587 of file vector3D.h.
Definition at line 537 of file vector3D.h.
std::array<double, 3> MecaCell::Vector3D::coords |
Definition at line 22 of file vector3D.h.
|
static |
Definition at line 24 of file vector3D.h.