SBDTypePhysicalIAVector3< Quantity > Class Template Reference

This template class represents three-dimensional physical interval vectors. More...

Public Types

enum  OverlapType {
  IncludeNone,
  IncludeAll,
  Subdivide
}
 The overlap type.
 
typedef SBQuantityProduct2< Quantity, Quantity >::Type QuantitySquared
 The type of the squared quantity.
 
typedef SBQuantityProduct3< Quantity, Quantity, Quantity >::Type QuantityCubed
 The type of the cubed quantity.
 

Constructors

 SBDTypePhysicalIAVector3 ()
 Constructs a physical interval vector with all components set to [0,0].
 
 SBDTypePhysicalIAVector3 (const Quantity &x)
 Constructs a physical interval vector with all components set to [x, x].
 
 SBDTypePhysicalIAVector3 (const Quantity &x, const Quantity &y, const Quantity &z)
 Constructs the physical interval vector [ [x, x] [y, y] [z, z] ].
 
 SBDTypePhysicalIAVector3 (Quantity v[3][2])
 Constructs the physical interval vector [ [v[0][0], v[0][1]] [v[1][0], v[1][1]] [v[2][0], v[2][1]] ].
 
 SBDTypePhysicalIAVector3 (Quantity xl, Quantity xu, Quantity yl, Quantity yu, Quantity zl, Quantity zu)
 Constructs the physical interval vector [ [xl, xu] [yl, yu] [zl, zu] ].
 
 SBDTypePhysicalIAVector3 (SBDTypePhysicalInterval< Quantity > v[3])
 Constructs the physical interval vector [ v[0] v[1] v[2] ].
 
 SBDTypePhysicalIAVector3 (const SBDTypePhysicalInterval< Quantity > &x, const SBDTypePhysicalInterval< Quantity > &y, const SBDTypePhysicalInterval< Quantity > &z)
 Constructs the physical interval vector [ x y z ].
 
 SBDTypePhysicalIAVector3 (SBDTypePhysicalVector3< Quantity > const &u)
 Constructs the physical interval vector [ [u.v[0], u.v[0]] [u.v[1], u.v[1]] [u.v[2], u.v[2]] ].
 
 SBDTypePhysicalIAVector3 (const SBDTypePhysicalIAVector3< Quantity > &u)
 Copy constructor.
 
 SBDTypePhysicalIAVector3 (SBDTypePhysicalIAVector3< Quantity > &&u)
 Move constructor.
 
 SBDTypePhysicalIAVector3 (double x)
 Constructs a dimensionless physical interval vector with all components set to [x, x].
 
 SBDTypePhysicalIAVector3 (double x, double y, double z)
 Constructs the dimensionless physical interval vector [ [x, x] [y, y] [z, z] ].
 
 SBDTypePhysicalIAVector3 (double val[3][2])
 Constructs the dimensionless physical interval vector [ [v[0][0], v[0][1]] [v[1][0], v[1][1]] [v[2][0], v[2][1]] ].
 
 SBDTypePhysicalIAVector3 (double xl, double xu, double yl, double yu, double zl, double zu)
 Constructs the physical interval vector [ [xl, xu] [yl, yu] [zl, zu] ].
 

Serialization

void serialize (SBCSerializer *serializer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER) const
 Serializes the physical interval vector using the provided serializer.
 
void unserialize (SBCSerializer *serializer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER)
 Unserializes the physical interval vector using the provided serializer.
 

Accessors

SBDTypePhysicalIAVector3< SBQuantity::dimensionlessgetValue () const
 Returns a dimensionless physical interval vector whose bounds are equal to those of this physical interval vector.
 
void setValue (const SBDTypePhysicalIAVector3< SBQuantity::dimensionless > &u)
 Sets the bounds of this physical interval vector equal to those of the dimensionless physical interval vector u.
 

Operators

template<typename QuantityB >
SBDTypePhysicalInterval< SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > operator| (const SBDTypePhysicalIAVector3< QuantityB > &u) const
 Returns the dot product of this physical interval vector with physical interval vector u.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > operator^ (const SBDTypePhysicalIAVector3< QuantityB > &u) const
 Returns the cross product of this physical interval vector with physical interval vector u.
 
SBDTypePhysicalIAVector3< Quantity > operator+ (const SBDTypePhysicalIAVector3< Quantity > &u) const
 Returns the sum of this physical interval vector with physical interval vector u.
 
SBDTypePhysicalIAVector3< Quantity > operator- (const SBDTypePhysicalIAVector3< Quantity > &u) const
 Returns the difference of this physical interval vector with physical interval vector u.
 
SBDTypePhysicalIAVector3< Quantity > operator* (double d) const
 Returns the product of this physical interval vector with double d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > operator* (QuantityB d) const
 Returns the product of this physical interval vector with physical quantity d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > operator* (SBDTypePhysicalInterval< QuantityB > d) const
 Returns the product of this physical interval vector with physical interval d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType< typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > operator* (const SBDTypePhysicalIAVector3< QuantityB > &u) const
 Returns the component-wise product of this physical interval vector with physical interval vector u. More...
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< Quantity > & operator*= (QuantityB d) const
 Multiplies this physical interval vector with physical quantity d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< Quantity > & operator*= (SBDTypePhysicalInterval< QuantityB > d) const
 Multiplies this physical interval vector with physical interval d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< Quantity > & operator*= (SBDTypePhysicalIAVector3< QuantityB > d) const
 Multiplies this physical interval vector with physical interval vector d.
 
SBDTypePhysicalIAVector3< Quantity > operator/ (double d) const
 Returns the division of this physical interval vector by double d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType< typename SBDQuantityUnitDivision< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > operator/ (QuantityB d) const
 Returns the division of this physical interval vector by physical quantity d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType< typename SBDQuantityUnitDivision< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > operator/ (SBDTypePhysicalInterval< QuantityB > d) const
 Returns the division of this physical interval vector by physical interval d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType< typename SBDQuantityUnitDivision< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > operator/ (const SBDTypePhysicalIAVector3< QuantityB > &u) const
 Returns the component-wise division of this physical interval vector by physical interval vector u. More...
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< Quantity > & operator/= (QuantityB d) const
 Divides this physical interval vector by physical quantity d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< Quantity > & operator/= (SBDTypePhysicalInterval< QuantityB > d) const
 Divides this physical interval vector by physical interval d.
 
template<typename QuantityB >
SBDTypePhysicalIAVector3< Quantity > & operator/= (SBDTypePhysicalIAVector3< QuantityB > d) const
 Divides this physical interval vector by physical interval vector d.
 
SBDTypePhysicalIAVector3< Quantity > & operator= (const SBDTypePhysicalIAVector3< Quantity > &u)
 Copy assignment.
 
SBDTypePhysicalIAVector3< Quantity > & operator= (SBDTypePhysicalIAVector3< Quantity > &&u)
 Move assignment.
 
SBDTypePhysicalIAVector3< Quantity > operator- () const
 Returns the opposite of this physical interval vector.
 
SBDTypePhysicalIAVector3< Quantity > & operator+= (const SBDTypePhysicalIAVector3< Quantity > &u)
 Adds physical interval vector u to this physical interval vector.
 
SBDTypePhysicalIAVector3< Quantity > & operator-= (const SBDTypePhysicalIAVector3< Quantity > &u)
 Subtracts physical interval vector u from this physical interval vector.
 
template<typename QuantityB >
 operator SBDTypePhysicalIAVector3< QuantityB > () const
 Converts this physical interval vector to a physical interval vector with units QuantityB.
 
template<typename QuantityB >
bool operator== (const SBDTypePhysicalIAVector3< QuantityB > &u) const
 Returns true if this physical interval vector is equal to physical interval vector u (component-wise)
 
template<typename QuantityB >
bool operator!= (const SBDTypePhysicalIAVector3< QuantityB > &u) const
 Returns true if this physical interval vector is different from physical interval vector u (component-wise)
 
SBDTypePhysicalInterval< Quantity > & operator[] (int index)
 Returns a reference to component index.
 
const SBDTypePhysicalInterval< Quantity > & operator[] (int index) const
 Returns a reference to component index (const version)
 

Useful functions

static const SBDTypePhysicalIAVector3< Quantity > zero
 The zero physical interval vector.
 
static const SBDTypePhysicalIAVector3< Quantity > empty
 The empty physical interval vector, with all components set to (+infinite, -infinite)
 
static const SBDTypePhysicalIAVector3< Quantity > infinite
 The infinite physical interval vector, with all components set to (+infinite, -infinite)
 
SBDTypePhysicalInterval< Quantity > i [3]
 The components of the physical interval vector.
 
void setZero ()
 Sets all components to [0,0].
 
SBDTypePhysicalVector3< Quantity > center () const
 Returns the center [ 0.5*(i[0].i[0]+i[0].i[1]) 0.5*(i[1].i[0]+i[1].i[1]) 0.5*(i[2].i[0]+i[2].i[1]) ] of the physical interval vector.
 
SBDTypePhysicalVector3< Quantity > diameter () const
 Returns the diameter [ (i[0].i[1]-i[0].i[0]) (i[1].i[1]-i[1].i[0]) (i[2].i[1]-i[2].i[0]) ] of the physical interval vector.
 
QuantityCubed volume () const
 Returns the volume (i[0].i[1]-i[0].i[0])*(i[1].i[1]-i[1].i[0])*(i[2].i[1]-i[2].i[0]) of the physical interval vector.
 
QuantitySquared area () const
 Returns the area 2.0*((i[0].i[1]-i[0].i[0])*(i[0].i[1]-i[0].i[0])+(i[1].i[1]-i[1].i[0])*(i[1].i[1]-i[1].i[0])+(i[2].i[1]-i[2].i[0])*(i[2].i[1]-i[2].i[0])) of the physical interval vector.
 
Quantity lengthsSum () const
 Returns the sum i[0].diameter()+i[1].diameter()+i[2].diameter() of the components diameters of the physical interval vector.
 
SBDTypePhysicalVector3< Quantity > lowerBound () const
 Returns the lower bound [ i[0].i[0] i[1].i[0] i[2].i[0] ] of the physical interval vector.
 
SBDTypePhysicalVector3< Quantity > upperBound () const
 Returns the upper bound [ i[0].i[1] i[1].i[1] i[2].i[1] ] of the physical interval vector.
 
void collapseToUpperBound ()
 Sets the upper bounds of the intervals equal to the lower bounds.
 
void collapseToLowerBound ()
 Sets the lower bounds of the intervals equal to the upper bounds.
 
bool overlaps (const SBDTypePhysicalIAVector3< Quantity > &u) const
 Returns true when this physical interval vector overlaps physical interval vector u.
 
bool overlaps (const SBDTypePhysicalIAVector3< Quantity > &u, const Quantity &cutoffDistance) const
 Returns true when the Manhattan distance between this physical interval vector and physical interval vector u is smaller than cutoffDistance.
 
bool overlaps (const SBDTypePhysicalIAVector3< Quantity > &u, const SBDTypeSymmetryTransform &t) const
 Returns true when this physical interval vector overlaps physical interval vector u transformed by t.
 
OverlapType overlapsAdvanced (SBDTypePhysicalIAVector3< Quantity > &u, const Quantity &cutoff, const QuantitySquared &cutoff2) const
 Returns the OverlapType between this physical interval vector and physical interval vector u.
 
OverlapType overlapsAdvanced (SBDTypePhysicalIAVector3 &u, const Quantity &cutoff, const QuantitySquared &cutoff2, const SBDTypeSymmetryTransform &t) const
 Returns the OverlapType between this physical interval vector and physical interval vector u transformed by t.
 
bool contains (const SBDTypePhysicalVector3< Quantity > &u) const
 Returns true when this physical interval vector contains the physical vector u.
 
bool contains (const SBDTypePhysicalIAVector3 &u) const
 Returns true when this physical interval vector contains in physical interval vector u.
 
bool isContainedIn (const SBDTypePhysicalIAVector3 &u) const
 Returns true when this physical interval vector is contained in physical interval vector u.
 
QuantitySquared distance2ToPoint (const SBDTypePhysicalVector3< Quantity > &u) const
 Returns the squared euclidean distance between this physical interval vector and physical vector u.
 
void split (SBDTypePhysicalIAVector3< Quantity > &u1, SBDTypePhysicalIAVector3< Quantity > &u2) const
 Splits this physical interval vector along the longest axis into physical interval vectors u1 andu2.
 
void expand (Quantity r)
 Expands all components of this physical interval vector by offset r.
 
void shrink (Quantity r)
 Srinks all components of this physical interval vector by offset r.
 
void reset (const SBDTypePhysicalVector3< Quantity > &v)
 Sets this physical interval vector to [ [u.v[0], u.v[0]] [u.v[1], u.v[1]] [u.v[2], u.v[2]] ].
 
void bound (const SBDTypePhysicalVector3< Quantity > &u)
 Enlarges this physical interval vector to contain the physical vector u.
 
void bound (const SBDTypePhysicalIAVector3< Quantity > &u)
 Enlarges this physical interval vector to contain the physical interval vector u.
 
void fit (const SBDTypePhysicalIAVector3< Quantity > &a, const SBDTypePhysicalIAVector3< Quantity > &b)
 Sets the components of this physical interval vector to exactly bound both physical interval vectors a and b.
 
void print () const
 Prints this physical interval vector.
 

Detailed Description

template<typename Quantity>
class SBDTypePhysicalIAVector3< Quantity >

Template Parameters
QuantityThe quantity type of the components

The SBDTypePhysicalIAVector3 template class represents physical three-dimensional interval vectors, i.e. three-dimensional vectors whose components are intervals of physical quantities. Interval vectors may be used to describe bounds on physical vectors (e.g. bounds on positions, on velocities, etc.), and perform interval arithmetics (IA) on these vectors.

Physical interval vectors use SAMSON's unit system. In a physical (interval) vector, all interval components have the same unit, so that the SBDTypePhysicalIAVector3 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. SBIAVector3 (dimensionless interval vector), SBIAPosition3 (interval vector with units of length), SBIAForce3 (interval vector with units of force), etc.

For example, SBIAPosition3 may be seen as the coordinates of a three-dimensional, axis-aligned box that bounds atomic coordinates, so that this class may be used to perform proximity queries (neighbor search), in particular thanks to functions such as SBIAPosition3::overlaps.

Interval arithmetics may be particulary useful to compute bounds on physical quantities:

// bound on the first position
);
// bound on the second position
);
// bound on the squared distance
SBSquareLengthInterval l2 = ((x2 - x1) | (x2 - x1));

Short name: SBPhysicalIAVector3

See also
SAMSON's unit system
SBDTypePhysicalInterval

Member Function Documentation

◆ operator*()

template<typename Quantity >
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType<typename SBDQuantityUnitMultiplication< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > SBDTypePhysicalIAVector3< Quantity >::operator* ( const SBDTypePhysicalIAVector3< QuantityB > &  u) const
inline

This operator returns the component-wise product of this physical interval vector with physical interval vector u, i.e. a physical interval vector in which each component is the product of the corresponding components in this physical interval vector and physical interval vector u.

◆ operator/()

template<typename Quantity >
template<typename QuantityB >
SBDTypePhysicalIAVector3< SBQuantityType<typename SBDQuantityUnitDivision< typename Quantity::UnitType, typename QuantityB::UnitType >::UnitType > > SBDTypePhysicalIAVector3< Quantity >::operator/ ( const SBDTypePhysicalIAVector3< QuantityB > &  u) const
inline

This operator returns the component-wise division of this physical interval vector by physical interval vector u, i.e. a physical interval vector in which each component is the division of the corresponding components in this physical interval vector and physical interval vector u.

This template class represents three-dimensional physical interval vectors.
Definition: SBDTypePhysicalIAVector3.hpp:65
This template class is used to describe physical intervals.
Definition: SBDTypePhysicalInterval.hpp:61
This template class defines physical quantity types.
Definition: SBDQuantityType.hpp:43