Assembly: Implement special drag mode for revolute.

This commit is contained in:
Paddle
2023-12-23 21:21:22 +01:00
committed by PaddleStroke
parent 43019a8f34
commit 48173f2b9d
12 changed files with 1121 additions and 183 deletions

View File

@@ -464,6 +464,22 @@ float_type Vector3<float_type>::GetAngle(const Vector3& rcVect) const
return float_type(acos(dot));
}
template<class float_type>
float_type Vector3<float_type>::GetAngleOriented(const Vector3& rcVect, const Vector3& norm) const
{
float_type angle = GetAngle(rcVect);
Vector3<float_type> crossProduct = Cross(rcVect);
// Use dot product to determine the sign
float_type dot = crossProduct.Dot(norm);
if (dot < 0) {
angle = 2 * traits_type::pi() - angle;
}
return angle;
}
template<class float_type>
void Vector3<float_type>::TransformToCoordinateSystem(const Vector3& rclBase,
const Vector3& rclDirX,

View File

@@ -194,6 +194,9 @@ public:
bool IsNull() const;
/// Get angle between both vectors. The returned value lies in the interval [0,pi].
float_type GetAngle(const Vector3& rcVect) const;
/// Get oriented angle between both vectors using a normal. The returned value lies in the
/// interval [0,2*pi].
float_type GetAngleOriented(const Vector3& rcVect, const Vector3& norm) const;
/** Transforms this point to the coordinate system defined by origin \a rclBase,
* vector \a vector rclDirX and vector \a vector rclDirY.
* \note \a rclDirX must be perpendicular to \a rclDirY, i.e. \a rclDirX * \a rclDirY = 0..