|
AGX Dynamics 2.41.2.0
|
A class holding 3 dimensional vectors and providing basic arithmetic. More...
#include <Vec3Template.h>
Public Types | |
| typedef T | Type |
Public Member Functions | |
| Vec3T () | |
| Default constructor. | |
| Vec3T (const T v[3]) | |
| Vec3T (const Vec2 &v2, T zz) | |
| Vec3T (const Vec3T ©)=default | |
| Copy constructor. | |
| Vec3T (const Vec3T ©, Real length) | |
| Vec3T (const Vec3T ©, T value, size_t i) | |
| template<typename T2 > | |
| Vec3T (const Vec3T< T2 > ©) | |
| Copy constructor for other types. | |
| Vec3T (T r) | |
| Vec3T (T x, T y, T z) | |
| void | clamp (const Vec3T &min, const Vec3T &max) |
| Clamp a vector between a lower and upper bound (per component). | |
| const Vec3T | cross (const Vec3T &rhs) const |
| Cross product method. | |
| Real | distance (const Vec3T &v2) const |
| Distance to another vector. | |
| Real | distance2 (const Vec3T &v2) const |
| Squared distance to another vector. | |
| Real | distance2 (const Vec3T &v2) const |
| Real | distance2 (const Vec3T &v2) const |
| Real | distance2 (const Vec3T &v2) const |
| Real | distance2 (const Vec3T &v2) const |
| bool | equalsZero () const |
| Vec3T | getPerpendicularUnitVector () const |
| Vec3T | getPerpendicularUnitVector (const Vec3T &v2) const |
| Return a unit vector perpendicular to this and another vector. | |
| bool | isFinite () const |
| bool | isNaN () const |
| bool | isValid () const |
| Real | length () const |
| Length of the vector = sqrt( vec . | |
| Real | length2 () const |
| Length squared of the vector = vec . | |
| T | maxComponent () const |
| size_t | maxElement () const |
| T | minComponent () const |
| size_t | minElement () const |
| Vec3T | normal () const |
| Real | normalize () |
| Normalize the vector so that it has length unity. | |
| bool | operator!= (const Vec3T &v) const |
| In-equality test. | |
| T | operator* (const Vec3T &rhs) const |
| Dot product. | |
| const Vec3T | operator* (T rhs) const |
| Multiply by scalar. | |
| Vec3T & | operator*= (T rhs) |
| Unary multiply by scalar. | |
| const Vec3T | operator+ (const T &rhs) const |
| Binary vector add. | |
| const Vec3T | operator+ (const Vec3T &rhs) const |
| Binary vector add. | |
| Vec3T & | operator+= (const T &rhs) |
| Unary vector add. | |
| Vec3T & | operator+= (const Vec3T &rhs) |
| Unary vector add. | |
| const Vec3T | operator- () const |
| Negation operator. | |
| const Vec3T | operator- (const T &rhs) const |
| Binary vector subtract. | |
| const Vec3T | operator- (const Vec3T &rhs) const |
| Binary vector subtract. | |
| Vec3T & | operator-= (const T &rhs) |
| Unary vector subtract. | |
| Vec3T & | operator-= (const Vec3T &rhs) |
| Unary vector subtract. | |
| const Vec3T | operator/ (T rhs) const |
| Divide by scalar. | |
| Vec3T & | operator/= (T rhs) |
| Unary divide by scalar. | |
| bool | operator== (const Vec3T &v) const |
| Equality test. | |
| T & | operator[] (size_t i) |
| const T & | operator[] (size_t i) const |
| const Vec3T | operator^ (const Vec3T &rhs) const |
| Cross product operator. | |
| T * | ptr () |
| const T * | ptr () const |
| void | set (const Vec3T &rhs) |
| void | set (T value) |
| void | set (T x, T y, T z) |
| Real | setLength (Real newLength) |
| Scale the vector so that is has the specified length. | |
| void | store3 (T *storage) const |
| Store the tree components to the given memory area. | |
| T & | x () |
| T | x () const |
| T & | y () |
| T | y () const |
| T & | z () |
| T | z () const |
Static Public Member Functions | |
| static Vec3T | AXIS (size_t i) |
| static Vec3T | componentMax (const Vec3T &v1, const Vec3T &v2) |
| Creates a new vector where each component is the maximum of this and the other vector. | |
| static Vec3T | componentMin (const Vec3T &v1, const Vec3T &v2) |
| Creates a new vector where each component is the minimum of this and the other vector. | |
| static Vec3T | div (const Vec3T &lhs, const Vec3T &rhs) |
| Element-wise-division. | |
| static Vec3T | mul (const Vec3T &lhs, const Vec3T &rhs) |
| Element-wise-multiplication. | |
| static Vec3T | random (const Vec3T< T > &min, const Vec3T< T > &max) |
| static Vec3T | random (T min=T(0), T max=T(1)) |
| static Vec3T | X_AXIS () |
| static Vec3T | Y_AXIS () |
| static Vec3T | Z_AXIS () |
Protected Attributes | |
| T | m_data [4] |
A class holding 3 dimensional vectors and providing basic arithmetic.
The 3D vector class holds an internal representations of vectors which can include padding and so on. At this level of the API, the object is provided for user convenience. In the internal representation used by the solvers, 3D vectors may be concatenated into larger vector blocks as seems fit.
Definition at line 45 of file Vec3Template.h.
| typedef T agx::Vec3T< T >::Type |
Definition at line 48 of file Vec3Template.h.
|
default |
Copy constructor.
| agx::Vec3T< T >::Vec3T | ( | const Vec3T< T > & | copy, |
| Real | length | ||
| ) |
Definition at line 290 of file Vec3Template.h.
References agx::Vec3T< T >::m_data.
| agx::Vec3T< T >::Vec3T | ( | const Vec3T< T > & | copy, |
| T | value, | ||
| size_t | i | ||
| ) |
Definition at line 301 of file Vec3Template.h.
References agx::Vec3T< T >::m_data.
|
explicit |
Copy constructor for other types.
Definition at line 313 of file Vec3Template.h.
| agx::Vec3T< T >::Vec3T |
Default constructor.
Definition at line 323 of file Vec3Template.h.
|
explicit |
Definition at line 332 of file Vec3Template.h.
| agx::Vec3T< T >::Vec3T | ( | T | x, |
| T | y, | ||
| T | z | ||
| ) |
Definition at line 339 of file Vec3Template.h.
|
explicit |
Definition at line 348 of file Vec3Template.h.
| agx::Vec3T< T >::Vec3T | ( | const Vec2 & | v2, |
| T | zz | ||
| ) |
Definition at line 357 of file Vec3Template.h.
|
static |
| i | The axis to choose. 0, 1 or 2. |
Definition at line 789 of file Vec3Template.h.
| void agx::Vec3T< T >::clamp | ( | const Vec3T< T > & | min, |
| const Vec3T< T > & | max | ||
| ) |
Clamp a vector between a lower and upper bound (per component).
Definition at line 433 of file Vec3Template.h.
References agx::clamp(), agx::max(), and agx::min().
Referenced by agx::clamp().
|
static |
Creates a new vector where each component is the maximum of this and the other vector.
Definition at line 385 of file Vec3Template.h.
Referenced by agx::max().
|
static |
Creates a new vector where each component is the minimum of this and the other vector.
Definition at line 379 of file Vec3Template.h.
Referenced by agx::min().
| const Vec3T< T > agx::Vec3T< T >::cross | ( | const Vec3T< T > & | rhs | ) | const |
Cross product method.
Definition at line 561 of file Vec3Template.h.
References agx::Vec3T< T >::m_data.
Referenced by agx::OrientedFrictionModelImpl< T >::calculateTangentPlane().
| Real agx::Vec3T< T >::distance | ( | const Vec3T< T > & | v2 | ) | const |
Distance to another vector.
Definition at line 695 of file Vec3Template.h.
Referenced by agx::WireContactSpringConstraint::calculateViolation(), and agxSDK::findDistanceFromPointToLine().
| Real agx::Vec3T< T >::distance2 | ( | const Vec3T< T > & | v2 | ) | const |
Squared distance to another vector.
Definition at line 876 of file Vec3Template.h.
References agx::Vec3T< T >::length2(), and agx::Vec3T< T >::m_data.
Referenced by agxSDK::pointInsideCircle().
| Real agx::Vec3T< UInt8 >::distance2 | ( | const Vec3T< T > & | v2 | ) | const |
Definition at line 883 of file Vec3Template.h.
References agx::Vec3T< T >::length2(), and agx::Vec3T< T >::m_data.
| Real agx::Vec3T< UInt16 >::distance2 | ( | const Vec3T< T > & | v2 | ) | const |
Definition at line 893 of file Vec3Template.h.
References agx::Vec3T< T >::length2(), and agx::Vec3T< T >::m_data.
| Real agx::Vec3T< UInt32 >::distance2 | ( | const Vec3T< T > & | v2 | ) | const |
Definition at line 903 of file Vec3Template.h.
References agx::Vec3T< T >::length2(), and agx::Vec3T< T >::m_data.
| Real agx::Vec3T< UInt64 >::distance2 | ( | const Vec3T< T > & | v2 | ) | const |
Definition at line 913 of file Vec3Template.h.
References agx::Vec3T< T >::length2(), and agx::Vec3T< T >::m_data.
|
static |
Element-wise-division.
Definition at line 576 of file Vec3Template.h.
| bool agx::Vec3T< T >::equalsZero |
Definition at line 441 of file Vec3Template.h.
References agx::equalsZero().
Referenced by agx::Vec3T< T >::getPerpendicularUnitVector().
| Vec3T< T > agx::Vec3T< T >::getPerpendicularUnitVector |
Definition at line 732 of file Vec3Template.h.
References agx::absolute(), agx::Vec3T< T >::normalize(), and agx::Vec3T< T >::set().
Referenced by agx::SwingData::getSwingAxis().
| Vec3T< T > agx::Vec3T< T >::getPerpendicularUnitVector | ( | const Vec3T< T > & | v2 | ) | const |
Return a unit vector perpendicular to this and another vector.
If the two vectors are parallel, an arbitrary perpendicular vector will be chosen.
Definition at line 759 of file Vec3Template.h.
References agx::Vec3T< T >::equalsZero(), and agx::Vec3T< T >::normalize().
| bool agx::Vec3T< T >::isFinite |
Definition at line 541 of file Vec3Template.h.
References agx::isFinite().
| bool agx::Vec3T< T >::isNaN |
Definition at line 535 of file Vec3Template.h.
References agx::isNaN().
| bool agx::Vec3T< T >::isValid |
Definition at line 529 of file Vec3Template.h.
References agx::isNaN().
Referenced by agxWire::transformPointToShape(), agxWire::transformPointToWorld(), agxWire::transformVectorToShape(), and agxWire::transformVectorToWorld().
| Real agx::Vec3T< T >::length |
Length of the vector = sqrt( vec .
vec )
Definition at line 683 of file Vec3Template.h.
Referenced by agx::WireContactFrictionConstraint::WireContactFrictionConstraint(), agx::WireContactSpringConstraint::WireContactSpringConstraint(), agxWire::findDistanceFromStartGivenPoint(), and agx::Vec3T< T >::setLength().
| Real agx::Vec3T< T >::length2 |
Length squared of the vector = vec .
vec
Definition at line 689 of file Vec3Template.h.
Referenced by agxCollide::agxGeometryQueries::LineSegment::containsPoint(), agx::Vec3T< T >::distance2(), agxSDK::findDistanceFromPointToLine(), agxWire::findDistanceFromStartGivenPoint(), agxSDK::findPlaneLineSegmentIntersection(), agxWire::findPointOnWire(), agxSDK::findSegmentCircleIntersections2D(), and agx::sphereBoxOverlapTest().
| T agx::Vec3T< T >::maxComponent |
Definition at line 397 of file Vec3Template.h.
| size_t agx::Vec3T< T >::maxElement |
Definition at line 418 of file Vec3Template.h.
References agx::absolute().
| T agx::Vec3T< T >::minComponent |
Definition at line 391 of file Vec3Template.h.
| size_t agx::Vec3T< T >::minElement |
Definition at line 403 of file Vec3Template.h.
References agx::absolute().
|
static |
Element-wise-multiplication.
Definition at line 569 of file Vec3Template.h.
| Vec3T< T > agx::Vec3T< T >::normal |
Definition at line 722 of file Vec3Template.h.
References agx::Vec3T< T >::normalize().
| Real agx::Vec3T< T >::normalize |
Normalize the vector so that it has length unity.
Definition at line 701 of file Vec3Template.h.
Referenced by agxSDK::LineContactEdge::LineContactEdge(), agx::PlaneT< T >::PlaneT(), agx::WireParticle::WireParticle(), agxSDK::calculateCylinderOffset(), agx::PointGravityField::calculateGravity(), agxSDK::calculateMeshOffset(), agx::OrientedFrictionModelImpl< T >::calculateTangentPlane(), agxSDK::findAdjustmentForMeshEdge(), agxSDK::findMostParallelEdgeAmongNeighboringTriangles(), agxWire::findPointOnWire(), agxSDK::getFuturePosition(), agx::Vec3T< T >::getPerpendicularUnitVector(), agxSDK::getProjection(), agxSDK::getTotalAngleShapeCoordinates(), agxSDK::LineContactEdge::mirror(), agx::Vec3T< T >::normal(), and agx::WireParticle::setEdge().
| bool agx::Vec3T< T >::operator!= | ( | const Vec3T< T > & | v | ) | const |
In-equality test.
Definition at line 372 of file Vec3Template.h.
References agx::Vec3T< T >::m_data.
| T agx::Vec3T< T >::operator* | ( | const Vec3T< T > & | rhs | ) | const |
| const Vec3T< T > agx::Vec3T< T >::operator* | ( | T | rhs | ) | const |
Multiply by scalar.
Definition at line 585 of file Vec3Template.h.
| Vec3T< T > & agx::Vec3T< T >::operator*= | ( | T | rhs | ) |
Unary multiply by scalar.
Definition at line 592 of file Vec3Template.h.
| const Vec3T< T > agx::Vec3T< T >::operator+ | ( | const T & | rhs | ) | const |
Binary vector add.
Definition at line 647 of file Vec3Template.h.
| const Vec3T< T > agx::Vec3T< T >::operator+ | ( | const Vec3T< T > & | rhs | ) | const |
Binary vector add.
Definition at line 617 of file Vec3Template.h.
| Vec3T< T > & agx::Vec3T< T >::operator+= | ( | const T & | rhs | ) |
Unary vector add.
Slightly more efficient because no temporary intermediate object.
Definition at line 653 of file Vec3Template.h.
| Vec3T< T > & agx::Vec3T< T >::operator+= | ( | const Vec3T< T > & | rhs | ) |
Unary vector add.
Slightly more efficient because no temporary intermediate object.
Definition at line 623 of file Vec3Template.h.
References agx::Vec3T< T >::m_data.
| const Vec3T< T > agx::Vec3T< T >::operator- |
Negation operator.
Returns the negative of the Vec3T.
Definition at line 677 of file Vec3Template.h.
| const Vec3T< T > agx::Vec3T< T >::operator- | ( | const T & | rhs | ) | const |
Binary vector subtract.
Definition at line 662 of file Vec3Template.h.
| const Vec3T< T > agx::Vec3T< T >::operator- | ( | const Vec3T< T > & | rhs | ) | const |
Binary vector subtract.
Definition at line 632 of file Vec3Template.h.
| Vec3T< T > & agx::Vec3T< T >::operator-= | ( | const T & | rhs | ) |
Unary vector subtract.
Definition at line 668 of file Vec3Template.h.
| Vec3T< T > & agx::Vec3T< T >::operator-= | ( | const Vec3T< T > & | rhs | ) |
Unary vector subtract.
Definition at line 638 of file Vec3Template.h.
References agx::Vec3T< T >::m_data.
| const Vec3T< T > agx::Vec3T< T >::operator/ | ( | T | rhs | ) | const |
Divide by scalar.
Definition at line 601 of file Vec3Template.h.
| Vec3T< T > & agx::Vec3T< T >::operator/= | ( | T | rhs | ) |
Unary divide by scalar.
Definition at line 607 of file Vec3Template.h.
| bool agx::Vec3T< T >::operator== | ( | const Vec3T< T > & | v | ) | const |
| T & agx::Vec3T< T >::operator[] | ( | size_t | i | ) |
Definition at line 481 of file Vec3Template.h.
| const T & agx::Vec3T< T >::operator[] | ( | size_t | i | ) | const |
Definition at line 487 of file Vec3Template.h.
| const Vec3T< T > agx::Vec3T< T >::operator^ | ( | const Vec3T< T > & | rhs | ) | const |
Cross product operator.
Definition at line 553 of file Vec3Template.h.
References agx::Vec3T< T >::m_data.
| T * agx::Vec3T< T >::ptr |
Definition at line 447 of file Vec3Template.h.
Referenced by agx::innerProd_6(), and agx::mult().
| const T * agx::Vec3T< T >::ptr |
Definition at line 453 of file Vec3Template.h.
|
static |
Definition at line 803 of file Vec3Template.h.
References agx::max(), agx::min(), and agx::random().
|
static |
Definition at line 797 of file Vec3Template.h.
References agx::max(), agx::min(), and agx::random().
| void agx::Vec3T< T >::set | ( | const Vec3T< T > & | rhs | ) |
Definition at line 473 of file Vec3Template.h.
References agx::Vec3T< T >::m_data.
| void agx::Vec3T< T >::set | ( | T | value | ) |
Definition at line 467 of file Vec3Template.h.
| void agx::Vec3T< T >::set | ( | T | x, |
| T | y, | ||
| T | z | ||
| ) |
Definition at line 459 of file Vec3Template.h.
Referenced by agxCollide::ContactPoint::clear(), agx::Vec3T< T >::getPerpendicularUnitVector(), agxCollide::BoundingAABB::reset(), agx::Matrix4x4T< T >::transform3x3(), and agx::Matrix4x4T< T >::transform3x3Inv().
| Real agx::Vec3T< T >::setLength | ( | Real | newLength | ) |
Scale the vector so that is has the specified length.
Definition at line 707 of file Vec3Template.h.
References agx::Vec3T< T >::length().
| void agx::Vec3T< T >::store3 | ( | T * | storage | ) | const |
Store the tree components to the given memory area.
Definition at line 810 of file Vec3Template.h.
| T & agx::Vec3T< T >::x |
Definition at line 493 of file Vec3Template.h.
Referenced by agxWire::CylindricalCoordinateRPY::CylindricalCoordinateRPY(), agx::Point2D::Point2D(), agxModel::BeamStiffnessDamping::apply(), agxVehicle::Wheel::attachConstraint(), agx::Matrix3x3T< T >::crossMatrix(), agx::AffineMatrix4x4T< T >::crossMatrix(), agx::Matrix4x4T< T >::crossMatrix(), agxSDK::fillEdgeVector(), agx::getCornerId(), agxTerrain::VoxelGridUtils::getGridPositionFromVoxelIndex(), agxSDK::getSigned(), agxTerrain::VoxelGridUtils::getVoxelIndexFromGridPosition(), agx::OrthoMatrix3x3::postMult(), agx::SPDMatrix3x3::postMult(), agx::Matrix3x3T< T >::postMult(), agx::Matrix4x4T< T >::postMult(), agx::OrthoMatrix3x3::preMult(), agx::SPDMatrix3x3::preMult(), agx::Matrix3x3T< T >::preMult(), agx::Matrix4x4T< T >::preMult(), agx::Matrix4x4T< T >::transform3x3(), and agx::Matrix4x4T< T >::transform3x3Inv().
| T agx::Vec3T< T >::x |
Definition at line 511 of file Vec3Template.h.
|
static |
Definition at line 771 of file Vec3Template.h.
| T & agx::Vec3T< T >::y |
Definition at line 499 of file Vec3Template.h.
Referenced by agxWire::CylindricalCoordinateRPY::CylindricalCoordinateRPY(), agx::Point2D::Point2D(), agxModel::BeamStiffnessDamping::apply(), agxSDK::calculateCylinderOffset(), agx::Matrix3x3T< T >::crossMatrix(), agx::AffineMatrix4x4T< T >::crossMatrix(), agx::Matrix4x4T< T >::crossMatrix(), agxSDK::fillEdgeVector(), agx::getCornerId(), agxTerrain::VoxelGridUtils::getGridPositionFromVoxelIndex(), agxSDK::getSigned(), agxTerrain::VoxelGridUtils::getVoxelIndexFromGridPosition(), agx::OrthoMatrix3x3::postMult(), agx::SPDMatrix3x3::postMult(), agx::Matrix3x3T< T >::postMult(), agx::Matrix4x4T< T >::postMult(), agx::OrthoMatrix3x3::preMult(), agx::SPDMatrix3x3::preMult(), agx::Matrix3x3T< T >::preMult(), agx::Matrix4x4T< T >::preMult(), agx::Matrix4x4T< T >::transform3x3(), and agx::Matrix4x4T< T >::transform3x3Inv().
| T agx::Vec3T< T >::y |
Definition at line 517 of file Vec3Template.h.
|
static |
Definition at line 777 of file Vec3Template.h.
| T & agx::Vec3T< T >::z |
Definition at line 505 of file Vec3Template.h.
Referenced by agxWire::CylindricalCoordinateRPY::CylindricalCoordinateRPY(), agx::Point2D::Point2D(), agxModel::BeamStiffnessDamping::apply(), agxVehicle::utils::createGeometryBox(), agx::Matrix3x3T< T >::crossMatrix(), agx::AffineMatrix4x4T< T >::crossMatrix(), agx::Matrix4x4T< T >::crossMatrix(), agxSDK::fillEdgeVector(), agxTerrain::VoxelGridUtils::getGridPositionFromVoxelIndex(), agxSDK::getSigned(), agxTerrain::VoxelGridUtils::getVoxelIndexFromGridPosition(), agx::OrthoMatrix3x3::postMult(), agx::SPDMatrix3x3::postMult(), agx::Matrix3x3T< T >::postMult(), agx::Matrix4x4T< T >::postMult(), agx::OrthoMatrix3x3::preMult(), agx::SPDMatrix3x3::preMult(), agx::Matrix3x3T< T >::preMult(), agx::Matrix4x4T< T >::preMult(), agx::Matrix4x4T< T >::transform3x3(), and agx::Matrix4x4T< T >::transform3x3Inv().
| T agx::Vec3T< T >::z |
Definition at line 523 of file Vec3Template.h.
|
static |
Definition at line 783 of file Vec3Template.h.
|
protected |
Definition at line 284 of file Vec3Template.h.
Referenced by agx::Vec3T< T >::Vec3T(), agx::Vec3T< T >::cross(), agx::Vec3T< T >::distance2(), agx::Vec3T< T >::operator!=(), agx::Vec3T< T >::operator*(), agx::Vec3T< T >::operator+=(), agx::Vec3T< T >::operator-=(), agx::Vec3T< T >::operator==(), agx::Vec3T< T >::operator^(), and agx::Vec3T< T >::set().