HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_Position.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  */
7 
8 #ifndef __SIM_Position_h__
9 #define __SIM_Position_h__
10 
11 #include "SIM_API.h"
12 #include <UT/UT_Vector3.h>
13 #include <UT/UT_Quaternion.h>
14 #include <UT/UT_VectorTypes.h>
15 #include "SIM_DataUtils.h"
16 
17 
18 /// This is the abstract base class for standard positional data.
19 /// Positional data is not exactly the same as a transform in that it
20 /// does not permit scales, and the rotation is always applied before
21 /// the translation.
23 {
24 public:
25  /// Gets a transform matrix from our position and rotation data.
26  /// This function just calls getTransformSubclass().
27  void getTransform(UT_DMatrix4 &xform) const;
28 
29  /// Gets the inverse transform matrix from our position and rotation.
30  /// This function just calls getInverseTransformSubclass().
31  void getInverseTransform(UT_DMatrix4 &xform) const;
32 
33  /// Gets a matrix representing the rotation component of the position.
34  /// This function just calls getRotationMatrixSubclass().
35  void getOrientation(UT_Quaternion &q) const;
36 
37  /// Gets a vector representing the translation component of the position.
38  /// This function just calls getPositionSubclass().
39  void getPosition(UT_Vector3 &t) const;
40 
41  /// Gets a vector representing the pivot component of the position.
42  /// This function just calls getPivotSubclass().
43  void getPivot(UT_Vector3 &p) const;
44 
45  /// Transforms a point into worldspace from object space.
46  /// This function just calls selfToWorldSubclass().
47  UT_Vector3 selfToWorld(const UT_Vector3 &p) const;
48 
49  /// Transforms a point into object space from world space.
50  /// This function just calls worldToSelfSubclass().
51  UT_Vector3 worldToSelf(const UT_Vector3 &p) const;
52 
53  /// Transforms a vector into worldspace from object space.
54  /// This function just calls selfToWorldVectorSubclass().
55  UT_Vector3 selfToWorldVector(const UT_Vector3 &p) const;
56 
57  /// Transforms a vector into object space from world space.
58  /// This function just calls worldToSelfVectorSubclass().
59  UT_Vector3 worldToSelfVector(const UT_Vector3 &p) const;
60 
61 protected:
62  explicit SIM_Position(const SIM_DataFactory *factory);
63  virtual ~SIM_Position();
64 
65  /// This implementation returns the identity matrix.
66  virtual void getTransformSubclass(UT_DMatrix4 &xform) const;
67 
68  /// This implementation calls getTransform and inverts it.
69  virtual void getInverseTransformSubclass(UT_DMatrix4 &xform) const;
70 
71  /// This implementation calls getTransform and extracts the rotations.
72  virtual void getOrientationSubclass(UT_Quaternion &q) const;
73 
74  /// This implementation calls getTransform and extracts the translates.
75  virtual void getPositionSubclass(UT_Vector3 &t) const;
76 
77  /// This implementation returns (0, 0, 0) as the pivot.
78  virtual void getPivotSubclass(UT_Vector3 &p) const;
79 
80  /// This implementation calls getTransform and does the multiply.
81  virtual UT_Vector3 selfToWorldSubclass(const UT_Vector3 &p) const;
82 
83  /// This implementation calls getInverseTransform and does the multiply.
84  virtual UT_Vector3 worldToSelfSubclass(const UT_Vector3 &p) const;
85 
86  /// This implementation calls getTransform and does the multiply.
87  virtual UT_Vector3 selfToWorldVectorSubclass(const UT_Vector3 &p) const;
88 
89  /// This implementation calls getInverseTransform and does the multiply.
90  virtual UT_Vector3 worldToSelfVectorSubclass(const UT_Vector3 &p) const;
91 
92 private:
95 };
96 
97 #endif
98 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
#define DECLARE_CLASSNAME(DataClass, SuperClass)
Definition: SIM_DataUtils.h:20
#define SIM_API
Definition: SIM_API.h:10