This template class is used to represent three-dimensional physical vectors. More...
Public Attributes | |
Quantity | v [3] |
The components of the physical vector. | |
Static Public Attributes | |
static const SBDTypePhysicalVector3< Quantity > | zero |
The zero physical vector. | |
Constructors | |
SBDTypePhysicalVector3 () | |
Constructs the physical vector [ 0 0 0 ]. | |
SBDTypePhysicalVector3 (const Quantity &x) | |
Constructs the physical vector [ x x x ]. | |
SBDTypePhysicalVector3 (const Quantity &x, const Quantity &y, const Quantity &z) | |
Constructs the physical vector [ x y z ]. | |
SBDTypePhysicalVector3 (Quantity u[3]) | |
Constructs the physical vector [ v [0] v [1] v [2] ]. | |
SBDTypePhysicalVector3 (double x) | |
Constructs a dimensionless physical vector with all components set to x . | |
SBDTypePhysicalVector3 (double x, double y, double z) | |
Constructs the dimensionless physical vector [ x y z ]. | |
SBDTypePhysicalVector3 (double u[3]) | |
Constructs the dimensionless physical vector [ v [0] v [1] v [2] ]. | |
Serialization | |
void | serialize (SBCSerializer *serializer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER) const |
Serializes the physical vector using the provided serializer . | |
void | unserialize (SBCSerializer *serializer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER) |
Unserializes the physical vector using the provided serializer . | |
Accessors | |
SBDTypePhysicalVector3< SBQuantity::dimensionless > | getValue () const |
Returns a dimensionless physical vector whose components are equal to those of this physical vector. | |
void | getValue (double *array) const |
Stores the components as doubles in array [0], array [1] and array [2]. | |
void | getValue (float *array) const |
Stores the components as floats in array [0], array [1] and array [2]. | |
void | setValue (const SBDTypePhysicalVector3< SBQuantity::dimensionless > &u) |
Sets the components of this physical vector equal to those of the dimensionless physical vector u . | |
Operators | |
template<typename QuantityB > | |
SBQuantityProduct2< Quantity, QuantityB >::Type | operator| (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns the dot product of this physical vector with physical vector u . | |
template<typename QuantityB > | |
SBDTypePhysicalVector3< SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > | operator^ (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns the cross product of this physical vector with physical vector u . | |
SBDTypePhysicalVector3< Quantity > | operator+ (const SBDTypePhysicalVector3< Quantity > &u) const |
Returns the sum of this physical vector with physical vector u . | |
SBDTypePhysicalVector3< Quantity > | operator- (const SBDTypePhysicalVector3< Quantity > &u) const |
Returns the difference of this physical vector with physical vector u . | |
SBDTypePhysicalVector3< Quantity > | operator* (double d) const |
Returns the product of this physical vector with double d . | |
template<typename QuantityB > | |
SBDTypePhysicalVector3< SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > | operator* (QuantityB d) const |
Returns the product of this physical vector with physical quantity d . | |
template<typename QuantityB > | |
SBDTypePhysicalVector3< SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > | operator* (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns the component-wise product of this physical vector with physical vector u . More... | |
template<typename QuantityB > | |
SBDTypePhysicalVector3< Quantity > & | operator*= (QuantityB d) |
Multiplies this physical vector with quantity d . | |
SBDTypePhysicalVector3< Quantity > | operator/ (double d) const |
Returns the division of this physical vector by double d . | |
template<typename QuantityB > | |
SBDTypePhysicalVector3< SBQuantityType< typename SBDQuantityUnitDivision< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > | operator/ (QuantityB d) const |
Returns the division of this physical vector by physical quantity d . | |
template<typename QuantityB > | |
SBDTypePhysicalVector3< SBQuantityType< typename SBDQuantityUnitDivision< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > | operator/ (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns the component-wise division of this physical vector by physical vector u . More... | |
template<typename QuantityB > | |
SBDTypePhysicalVector3< Quantity > & | operator/= (QuantityB d) |
Divides this physical vector by physical quantity d . | |
SBDTypePhysicalVector3< Quantity > | operator- () const |
Returns the opposite of this physical vector. | |
SBDTypePhysicalVector3< Quantity > & | operator+= (const SBDTypePhysicalVector3< Quantity > &u) |
Adds physical vector u to this physical vector. | |
SBDTypePhysicalVector3< Quantity > & | operator-= (const SBDTypePhysicalVector3< Quantity > &u) |
Subtracts physical vector u from this physical vector. | |
template<typename QuantityB > | |
operator SBDTypePhysicalVector3< QuantityB > () const | |
Converts this physical vector to a physical vector with units QuantityB . | |
template<typename QuantityB > | |
bool | operator== (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns true if this physical vector is equal to physical vector u (component-wise) | |
template<typename QuantityB > | |
bool | operator!= (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns true if this physical vector is different from physical vector u (component-wise) | |
template<typename QuantityB > | |
bool | operator< (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns true if this physical vector is smaller than physical vector u (lexicographic comparison) | |
template<typename QuantityB > | |
bool | operator> (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns true if this physical vector is larger than physical vector u (lexicographic comparison) | |
template<typename QuantityB > | |
bool | operator<= (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns true if this physical vector is smaller or equal than physical vector u (lexicographic comparison) | |
template<typename QuantityB > | |
bool | operator>= (const SBDTypePhysicalVector3< QuantityB > &u) const |
Returns true if this physical vector is larger or equal than physical vector u (lexicographic comparison) | |
Quantity & | operator[] (int index) |
Returns a reference to component index . | |
const Quantity & | operator[] (int index) const |
Returns a reference to component index (const version) | |
Useful functions | |
void | setZero () |
Sets all components to zero. | |
Quantity | norm () const |
Returns the norm of this physical vector. | |
SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename Quantity::UnitType >::UnitType > | norm2 () const |
Returns the squared norm of this physical vector. | |
void | print () const |
Prints this physical vector. | |
SBDTypePhysicalVector3< SBQuantity::dimensionless > | normalizedVersion () const |
Returns the normalized version of this physical vector. | |
SBDTypePhysicalVector3< Quantity > | normalizedVersionWithUnits () const |
Returns the normalized version of this physical vector, but with preserved units. | |
void | normalizeWithUnits () |
Normalizes this physical vector while preserving units. | |
void | normalize () |
Normalizes this dimensionless physical vector. | |
template<typename QuantityLower , typename QuantityUpper > | |
void | updateMinMax (SBDTypePhysicalVector3< QuantityLower > &lower, SBDTypePhysicalVector3< QuantityUpper > &upper) const |
Updates the lower and upper vector bounds with this physical vector. More... | |
void | swap (unsigned int i, unsigned j) |
Swaps components i and j of this physical vector. | |
Quantity | The quantity type of the physical vector |
This template class represents three-dimensional physical vectors, i.e. vectors whose components are physical quantities, and thus use SAMSON's unit system. In a physical vector (e.g. a position vector or a force vector), the three components have the same unit, and the SBDTypePhysicalVector3 template class is parameterized by only one type: Quantity
.
Most of the time, developers of SAMSON Elements do not have to use this template, but may directly use some predefined types, e.g. SBVector3 (dimensionless three-dimensional vector), SBPosition3 (three-dimensional vectors with length dimensions), etc.
For example, if atomPointer
is a pointer to an atom, then the atom's position is a SBPosition3 physical vector:
Short name: SBPhysicalVector3
|
inline |
This operator returns the component-wise product of this physical vector with physical vector u
, i.e. a physical vector in which each component is the product of the corresponding components in this physical vector and physical vector u
.
|
inline |
This operator returns the component-wise division of this physical vector by physical vector u
, i.e. a physical vector in which each component is the division of the corresponding components in this physical vector and physical vector u
.
|
inline |
lower | The lower bound |
upper | The upper bound |
If necessary, this function updates the lower
and upper
bounds to ensure that they contain this physical vector.