| 1 | /* |
| 2 | * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. |
| 3 | * |
| 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property |
| 5 | * and proprietary rights in and to this software, related documentation |
| 6 | * and any modifications thereto. Any use, reproduction, disclosure or |
| 7 | * distribution of this software and related documentation without an express |
| 8 | * license agreement from NVIDIA CORPORATION is strictly prohibited. |
| 9 | */ |
| 10 | // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. |
| 11 | // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. |
| 12 | |
| 13 | |
| 14 | #ifndef PX_MATHUTILS_H |
| 15 | #define PX_MATHUTILS_H |
| 16 | |
| 17 | /** \addtogroup common |
| 18 | @{ |
| 19 | */ |
| 20 | |
| 21 | #include "common/PxPhysXCommonConfig.h" |
| 22 | #include "foundation/PxTransform.h" |
| 23 | |
| 24 | #ifndef PX_DOXYGEN |
| 25 | namespace physx |
| 26 | { |
| 27 | #endif |
| 28 | |
| 29 | |
| 30 | /** |
| 31 | \brief finds the shortest rotation between two vectors. |
| 32 | |
| 33 | \param[in] from the vector to start from |
| 34 | \param[in] target the vector to rotate to |
| 35 | \return a rotation about an axis normal to the two vectors which takes one to the other via the shortest path |
| 36 | */ |
| 37 | |
| 38 | PX_FOUNDATION_API PxQuat PxShortestRotation(const PxVec3& from, const PxVec3& target); |
| 39 | |
| 40 | |
| 41 | /* \brief diagonalizes a 3x3 matrix y |
| 42 | |
| 43 | The returned matrix satisfies M = R * D * R', where R is the rotation matrix for the output quaternion, R' its transpose, and D the diagonal matrix |
| 44 | |
| 45 | \param[in] m the matrix to diagonalize |
| 46 | \param[out] axes a quaternion rotation which diagonalizes the matrix |
| 47 | \return the vector diagonal of the diagonalized matrix. |
| 48 | */ |
| 49 | |
| 50 | PX_FOUNDATION_API PxVec3 PxDiagonalize(const PxMat33& m, PxQuat &axes); |
| 51 | |
| 52 | #ifndef PX_DOXYGEN |
| 53 | } // namespace physx |
| 54 | #endif |
| 55 | |
| 56 | /** @} */ |
| 57 | #endif |
| 58 | |