File indexing completed on 2025-01-18 10:02:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _AIS_WalkDelta_HeaderFile
0015 #define _AIS_WalkDelta_HeaderFile
0016
0017 #include <Standard_Real.hxx>
0018
0019
0020 enum AIS_WalkTranslation
0021 {
0022 AIS_WalkTranslation_Forward = 0,
0023 AIS_WalkTranslation_Side,
0024 AIS_WalkTranslation_Up,
0025 };
0026
0027
0028 enum AIS_WalkRotation
0029 {
0030 AIS_WalkRotation_Yaw = 0,
0031 AIS_WalkRotation_Pitch,
0032 AIS_WalkRotation_Roll,
0033 };
0034
0035
0036 struct AIS_WalkPart
0037 {
0038 Standard_Real Value;
0039 Standard_Real Pressure;
0040 Standard_Real Duration;
0041
0042
0043 bool IsEmpty() const { return Abs (Value) <= RealSmall(); }
0044
0045
0046 AIS_WalkPart() : Value (0.0), Pressure (1.0), Duration (0.0) {}
0047 };
0048
0049
0050 struct AIS_WalkDelta
0051 {
0052
0053 AIS_WalkDelta()
0054 : myIsDefined (false), myIsJumping (false), myIsCrouching (false), myIsRunning (false) {}
0055
0056
0057 const AIS_WalkPart& operator[] (AIS_WalkTranslation thePart) const { return myTranslation[thePart]; }
0058
0059
0060 AIS_WalkPart& operator[] (AIS_WalkTranslation thePart) { return myTranslation[thePart]; }
0061
0062
0063 const AIS_WalkPart& operator[] (AIS_WalkRotation thePart) const { return myRotation[thePart]; }
0064
0065
0066 AIS_WalkPart& operator[] (AIS_WalkRotation thePart) { return myRotation[thePart]; }
0067
0068
0069 bool IsJumping() const { return myIsJumping; }
0070
0071
0072 void SetJumping (bool theIsJumping) { myIsJumping = theIsJumping; }
0073
0074
0075 bool IsCrouching() const { return myIsCrouching; }
0076
0077
0078 void SetCrouching (bool theIsCrouching) { myIsCrouching = theIsCrouching; }
0079
0080
0081 bool IsRunning() const { return myIsRunning; }
0082
0083
0084 void SetRunning (bool theIsRunning) { myIsRunning = theIsRunning; }
0085
0086
0087 bool IsDefined() const { return myIsDefined || !IsEmpty(); }
0088
0089
0090 void SetDefined (bool theIsDefined) { myIsDefined = theIsDefined; }
0091
0092
0093 bool IsEmpty() const { return !ToMove() && !ToRotate(); }
0094
0095
0096 bool ToMove() const
0097 {
0098 return !myTranslation[AIS_WalkTranslation_Forward].IsEmpty()
0099 || !myTranslation[AIS_WalkTranslation_Side].IsEmpty()
0100 || !myTranslation[AIS_WalkTranslation_Up].IsEmpty();
0101 }
0102
0103
0104 bool ToRotate() const
0105 {
0106 return !myRotation[AIS_WalkRotation_Yaw].IsEmpty()
0107 || !myRotation[AIS_WalkRotation_Pitch].IsEmpty()
0108 || !myRotation[AIS_WalkRotation_Roll].IsEmpty();
0109 }
0110
0111 private:
0112
0113 AIS_WalkPart myTranslation[3];
0114 AIS_WalkPart myRotation[3];
0115 bool myIsDefined;
0116 bool myIsJumping;
0117 bool myIsCrouching;
0118 bool myIsRunning;
0119
0120 };
0121
0122 #endif