00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Side Effects Software Inc. 00008 * 477 Richmond Street West, Suite 1001 00009 * Toronto, Ontario 00010 * Canada M5V 3E7 00011 * 416-504-9876 00012 */ 00013 00014 #ifndef __SIM_Position_h__ 00015 #define __SIM_Position_h__ 00016 00017 #include "SIM_API.h" 00018 #include <UT/UT_Vector3.h> 00019 #include <UT/UT_Quaternion.h> 00020 #include "SIM_DataUtils.h" 00021 00022 class UT_DMatrix4; 00023 00024 /// This is the abstract base class for standard positional data. 00025 /// Positional data is not exactly the same as a transform in that it 00026 /// does not permit scales, and the rotation is always applied before 00027 /// the translation. 00028 class SIM_API SIM_Position : public SIM_Data 00029 { 00030 public: 00031 /// Gets a transform matrix from our position and rotation data. 00032 /// This function just calls getTransformSubclass(). 00033 void getTransform(UT_DMatrix4 &xform) const; 00034 00035 /// Gets the inverse transform matrix from our position and rotation. 00036 /// This function just calls getInverseTransformSubclass(). 00037 void getInverseTransform(UT_DMatrix4 &xform) const; 00038 00039 /// Gets a matrix representing the rotation component of the position. 00040 /// This function just calls getRotationMatrixSubclass(). 00041 void getOrientation(UT_Quaternion &q) const; 00042 00043 /// Gets a vector representing the translation component of the position. 00044 /// This function just calls getPositionSubclass(). 00045 void getPosition(UT_Vector3 &t) const; 00046 00047 /// Gets a vector representing the pivot component of the position. 00048 /// This function just calls getPivotSubclass(). 00049 void getPivot(UT_Vector3 &p) const; 00050 00051 /// Transforms a point into worldspace from object space. 00052 /// This function just calls selfToWorldSubclass(). 00053 UT_Vector3 selfToWorld(const UT_Vector3 &p) const; 00054 00055 /// Transforms a point into object space from world space. 00056 /// This function just calls worldToSelfSubclass(). 00057 UT_Vector3 worldToSelf(const UT_Vector3 &p) const; 00058 00059 protected: 00060 explicit SIM_Position(const SIM_DataFactory *factory); 00061 virtual ~SIM_Position(); 00062 00063 /// This implementation returns the identity matrix. 00064 virtual void getTransformSubclass(UT_DMatrix4 &xform) const; 00065 00066 /// This implementation calls getTransform and inverts it. 00067 virtual void getInverseTransformSubclass(UT_DMatrix4 &xform) const; 00068 00069 /// This implementation calls getTransform and extracts the rotations. 00070 virtual void getOrientationSubclass(UT_Quaternion &q) const; 00071 00072 /// This implementation calls getTransform and extracts the translates. 00073 virtual void getPositionSubclass(UT_Vector3 &t) const; 00074 00075 /// This implementation returns (0, 0, 0) as the pivot. 00076 virtual void getPivotSubclass(UT_Vector3 &p) const; 00077 00078 /// This implementation calls getTransform and does the multiply. 00079 virtual UT_Vector3 selfToWorldSubclass(const UT_Vector3 &p) const; 00080 00081 /// This implementation calls getInverseTransform and does the multiply. 00082 virtual UT_Vector3 worldToSelfSubclass(const UT_Vector3 &p) const; 00083 00084 private: 00085 DECLARE_STANDARD_GETCASTTOTYPE(); 00086 DECLARE_CLASSNAME(SIM_Position, SIM_Data); 00087 }; 00088 00089 #endif 00090
1.5.9