File indexing completed on 2025-01-18 10:03:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _gp_QuaternionNLerp_HeaderFile
0015 #define _gp_QuaternionNLerp_HeaderFile
0016
0017 #include <gp_Quaternion.hxx>
0018
0019
0020
0021 class gp_QuaternionNLerp
0022 {
0023 public:
0024
0025
0026
0027
0028
0029
0030 static gp_Quaternion Interpolate (const gp_Quaternion& theQStart,
0031 const gp_Quaternion& theQEnd,
0032 Standard_Real theT)
0033 {
0034 gp_Quaternion aResult;
0035 gp_QuaternionNLerp aLerp (theQStart, theQEnd);
0036 aLerp.Interpolate (theT, aResult);
0037 return aResult;
0038 }
0039
0040 public:
0041
0042
0043 gp_QuaternionNLerp() {}
0044
0045
0046 gp_QuaternionNLerp (const gp_Quaternion& theQStart, const gp_Quaternion& theQEnd)
0047 {
0048 Init (theQStart, theQEnd);
0049 }
0050
0051
0052 void Init (const gp_Quaternion& theQStart, const gp_Quaternion& theQEnd)
0053 {
0054 InitFromUnit (theQStart.Normalized(), theQEnd.Normalized());
0055 }
0056
0057
0058 void InitFromUnit (const gp_Quaternion& theQStart, const gp_Quaternion& theQEnd)
0059 {
0060 myQStart = theQStart;
0061 myQEnd = theQEnd;
0062 Standard_Real anInner = myQStart.Dot (myQEnd);
0063 if (anInner < 0.0)
0064 {
0065 myQEnd = -myQEnd;
0066 }
0067 myQEnd -= myQStart;
0068 }
0069
0070
0071 void Interpolate (Standard_Real theT, gp_Quaternion& theResultQ) const
0072 {
0073 theResultQ = myQStart + myQEnd * theT;
0074 }
0075
0076 private:
0077
0078 gp_Quaternion myQStart;
0079 gp_Quaternion myQEnd;
0080
0081 };
0082
0083 #endif