HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  ~SIM_PositionSimple() override;
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  void optionChangedSubclass(const char *name) override;
43 
44  /// Gets a transform matrix from our position and rotation data.
45  void getTransformSubclass(UT_DMatrix4 &xform) const override;
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  void getInverseTransformSubclass(UT_DMatrix4 &xform) const override;
51 
52  /// Gets a rotation matrix from our position data.
53  void getOrientationSubclass(UT_Quaternion &q) const override;
54 
55  /// Gets a translation vector from our position data.
56  void getPositionSubclass(UT_Vector3 &t) const override;
57 
58  /// Gets pivot info from our position data.
59  void getPivotSubclass(UT_Vector3 &p) const override;
60 
61  /// Transforms a point into worldspace from object space.
62  /// This is the same as multiplying by getTransform()
63  UT_Vector3 selfToWorldSubclass(const UT_Vector3 &p) const override;
64 
65  /// Transforms a point into object space from world space.
66  /// This is the same as multiplying by getInverseTransform()
67  UT_Vector3 worldToSelfSubclass(const UT_Vector3 &p) const override;
68 
69  /// Transforms a vector into worldspace from object space.
70  /// This is the same as multiplying by getTransform()
71  UT_Vector3 selfToWorldVectorSubclass(const UT_Vector3 &p) const override;
72 
73  /// Transforms a vector into object space from world space.
74  /// This is the same as multiplying by getInverseTransform()
75  UT_Vector3 worldToSelfVectorSubclass(const UT_Vector3 &p) const override;
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  void interpolateSubclass(const SIM_Data *source1,
81  const SIM_Data *source2,
82  fpreal interp) override;
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:50
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:162
virtual UT_Vector3 selfToWorldVectorSubclass(const UT_Vector3 &p) const
This implementation calls getTransform and does the multiply.
GLdouble GLdouble GLdouble q
Definition: glad.h:2445
#define GETSET_DATA_FUNCS_V3(DataName, FuncName)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
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:786
GLdouble t
Definition: glad.h:2397
#define SIM_NAME_POSITION
Definition: SIM_Names.h:168
#define SIM_NAME_ORIENTATION
Definition: SIM_Names.h:159
#define GETSET_DATA_FUNCS_Q(DataName, FuncName)
fpreal64 fpreal
Definition: SYS_Types.h:277
virtual void getOrientationSubclass(UT_Quaternion &q) const
This implementation calls getTransform and extracts the rotations.
#define SIM_API
Definition: SIM_API.h:12
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.