LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
|
Basic 3-D coordinates class. More...
#include <Coord.hpp>
Public Types | |
typedef T | element_type |
Public Member Functions | |
Coord (const T ax, const T ay, const T az) | |
Coord (const Coord< T > &o) | |
Coord (const T x) | |
void | x (const T ax) |
void | y (const T ay) |
void | z (const T az) |
const T & | x (void) const |
const T & | y (void) const |
const T & | z (void) const |
T & | x (void) |
T & | y (void) |
T & | z (void) |
T & | operator[] (const unsigned int i) |
Retrieve an element from the Coord with range-checking. | |
const T & | operator[] (const unsigned int i) const |
Retrieve an element from a const Coord with range-checking. | |
void | set (const T x, const T y, const T z) |
Short-cut to set the cartesian coordinates... | |
const Coord< T > & | operator= (const Coord< T > &c) |
Coord< T > & | operator/= (const T rhs) |
Division by a constant. | |
Coord< T > | operator/ (const T rhs) const |
Coord< T > & | operator+= (const T rhs) |
Coord< T > | operator+ (const T rhs) const |
Coord< T > & | operator+= (const Coord< T > &rhs) |
Handle addition. | |
Coord< T > | operator+ (const Coord< T > &rhs) const |
Coord< T > & | operator-= (const Coord< T > &rhs) |
Subtraction. | |
Coord< T > | operator- (const Coord< T > &rhs) const |
Coord< T > & | operator-= (const T rhs) |
Coord< T > | operator- (const T rhs) const |
Coord< T > | operator- () |
Unary negation. | |
Coord< T > & | operator*= (const T rhs) |
Multiplication by a constant. | |
Coord< T > | operator* (const T rhs) const |
T | dot (const Coord< T > &rhs) const |
Dot product. | |
T | uvdot (const Coord< T > &rhs) const |
Unit vector dot product (cosine of projective angle) | |
T | operator* (const Coord< T >rhs) const |
Coord< T > | cross (const Coord< T > &rhs) const |
Cross-product. Returns a new Coord<T> | |
Coord< T > & | operator^= (const Coord< T > &rhs) |
Mutating cross-product (note precedence issues) | |
Coord< T > | operator^ (const Coord< T > &rhs) const |
Cross-product (note precedence issues) | |
Coord< T > & | operator%= (const Coord< T > &rhs) |
Modulo of each component of the Coord with a constant. | |
Coord< T > | operator% (const Coord< T > &rhs) const |
void | reimage (const Coord< T > &box) |
Handle coordinates with periodic boundary conditions. | |
double | length2 (void) const |
Length of the Coord (as a vector) squared. | |
double | length (void) const |
Length of the coordinate (as a vector) | |
double | distance2 (const Coord< T > &o) const |
Distance squared between two coordinates. | |
double | distance2 (const Coord< T > &o, const Coord< T > &box) const |
double | distance (const Coord< T > &o) const |
Distance between two coordinates. | |
double | distance (const Coord< T > &o, const Coord< T > &box) const |
void | random (void) |
Generate a random vector on a unit sphere. | |
void | zero (void) |
Zero out the coordinates (while keeping it homogenous) | |
bool | operator== (const Coord< T > &rhs) const |
Compute equality based on norm(u-v) < epsilon. | |
bool | operator!= (const Coord< T > &rhs) const |
Compute inequality based on ! ==. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Coord< T > &o) |
Output the coordinate in pseudo-XML. | |
std::istream & | operator>> (std::istream &is, Coord< T > &i) |
Coord< T > | operator+ (const T lhs, const Coord< T > &rhs) |
Handle the case of T + Coord<T> | |
Coord< T > | operator- (const T lhs, const Coord< T > &rhs) |
Handle the case of T - Coord<T> | |
Coord< T > | operator* (const Matrix44< T > &, const Coord< T > &) |
For matrix-vector multiply. | |
Coord< T > | operator* (const T lhs, const Coord< T > &rhs) |
Handle T * Coord<T> | |
Coord< T > | operator/ (const T lhs, const Coord< T > &rhs) |
T / Coord<T> case... This may not actually be a good idea? | |
Basic 3-D coordinates class.
Coordinates are stored internally as homogenous coordinates in an array of T. There is some awkward support for making coordinates in higher-dimensions, but caveat programmer...
Warnings:
Notes:
|
inline |
Distance between two coordinates considering periodic boundary conditions
|
inline |
Distance squared between two coordinates considering periodic boundary conditions
|
inline |
Generate a random vector on a unit sphere.
Note: this method uses a singleton random number generator set up by LOOS, but doesn't set the initial seed. Instead, the calling program needs to do that, either by calling randomSeedRNG() (see utils_random.cpp), which seeds off the time, or by generating the seed another way.
For matrix-vector multiply.
Matrix-vector multiply This has to be a friend outside the class for GCC to be happy...