HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_PositionSimple.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_PositionSimple_h__
9 #define __SIM_PositionSimple_h__
10 
11 #include "SIM_API.h"
12 #include "SIM_Position.h"
13 #include "SIM_OptionsUser.h"
14 
15 /// This is the simplest implementation for standard positional data.
16 /// Positional data is not exactly the same as a transform in that it
17 /// does not permit scales, and the rotation is always applied before
18 /// the translation.
20  public SIM_OptionsUser
21 {
22 public:
23  /// TODO: These accessors are shadowing the SIM_Position versions.
24  /// This is a bad thing as getPivot() will not invoke getPivotSubclass
25  /// and anyone trying to chase the call graph will see an apparent
26  /// infinite loop. We need to rename these to RawPosition, I think.
27 
28  /// Control the translation attribute of the position.
30  /// Control the pivot point which the orientation is applied to.
32  /// Control the orientation attribute of the position.
34 
35 protected:
36  explicit SIM_PositionSimple(const SIM_DataFactory *factory);
37  virtual ~SIM_PositionSimple();
38 
39  /// Override this function so that we can understand an option
40  /// called rotation. Although this attribute isn't supported directly,
41  /// it can be reinterpreted into the orientation option.
42  virtual void optionChangedSubclass(const char *name);
43 
44  /// Gets a transform matrix from our position and rotation data.
45  virtual void getTransformSubclass(UT_DMatrix4 &xform) const;
46 
47  /// Gets the inverse transform matrix from our position and rotation.
48  /// Because we build our transform matrices just in time, this is
49  /// faster than getTransform() & invert().
50  virtual void getInverseTransformSubclass(UT_DMatrix4 &xform) const;
51 
52  /// Gets a rotation matrix from our position data.
53  virtual void getOrientationSubclass(UT_Quaternion &q) const;
54 
55  /// Gets a translation vector from our position data.
56  virtual void getPositionSubclass(UT_Vector3 &t) const;
57 
58  /// Gets pivot info from our position data.
59  virtual void getPivotSubclass(UT_Vector3 &p) const;
60 
61  /// Transforms a point into worldspace from object space.
62  /// This is the same as multiplying by getTransform()
63  virtual UT_Vector3 selfToWorldSubclass(const UT_Vector3 &p) const;
64 
65  /// Transforms a point into object space from world space.
66  /// This is the same as multiplying by getInverseTransform()
67  virtual UT_Vector3 worldToSelfSubclass(const UT_Vector3 &p) const;
68 
69  /// Transforms a vector into worldspace from object space.
70  /// This is the same as multiplying by getTransform()
71  virtual UT_Vector3 selfToWorldVectorSubclass(const UT_Vector3 &p) const;
72 
73  /// Transforms a vector into object space from world space.
74  /// This is the same as multiplying by getInverseTransform()
75  virtual UT_Vector3 worldToSelfVectorSubclass(const UT_Vector3 &p) const;
76 
77  /// Interpolation of positions can't be done in a componentwise
78  /// fashion. If pivot is changing over time it is important
79  /// that we adjust the rotation/translation to account for it.
80  virtual void interpolateSubclass(const SIM_Data *source1,
81  const SIM_Data *source2,
82  fpreal interp);
83 
84 private:
85  static const SIM_DopDescription *getPositionSimpleDopDescription();
86 
90  "Position",
91  getPositionSimpleDopDescription());
92 };
93 
94 #endif
95 
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
virtual void optionChangedSubclass(const char *name)
virtual UT_Vector3 worldToSelfSubclass(const UT_Vector3 &p) const
This implementation calls getInverseTransform and does the multiply.
virtual UT_Vector3 worldToSelfVectorSubclass(const UT_Vector3 &p) const
This implementation calls getInverseTransform and does the multiply.
#define SIM_NAME_PIVOT
Definition: SIM_Names.h:161
virtual UT_Vector3 selfToWorldVectorSubclass(const UT_Vector3 &p) const
This implementation calls getTransform and does the multiply.
#define GETSET_DATA_FUNCS_V3(DataName, FuncName)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
virtual void getInverseTransformSubclass(UT_DMatrix4 &xform) const
This implementation calls getTransform and inverts it.
virtual void getTransformSubclass(UT_DMatrix4 &xform) const
This implementation returns the identity matrix.
virtual void getPositionSubclass(UT_Vector3 &t) const
This implementation calls getTransform and extracts the translates.
virtual void interpolateSubclass(const SIM_Data *source1, const SIM_Data *source2, fpreal interp)
GLuint const GLchar * name
Definition: glcorearb.h:785
#define SIM_NAME_POSITION
Definition: SIM_Names.h:167
#define SIM_NAME_ORIENTATION
Definition: SIM_Names.h:158
double fpreal
Definition: SYS_Types.h:263
#define GETSET_DATA_FUNCS_Q(DataName, FuncName)
virtual void getOrientationSubclass(UT_Quaternion &q) const
This implementation calls getTransform and extracts the rotations.
#define SIM_API
Definition: SIM_API.h:10
virtual void getPivotSubclass(UT_Vector3 &p) const
This implementation returns (0, 0, 0) as the pivot.
virtual UT_Vector3 selfToWorldSubclass(const UT_Vector3 &p) const
This implementation calls getTransform and does the multiply.