HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_ForceMagnet.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_ForceMagnet_h__
9 #define __SIM_ForceMagnet_h__
10 
11 #include "SIM_API.h"
12 #include "SIM_Force.h"
13 #include "SIM_OptionsUser.h"
14 
15 /// This is an implementation of the SIM_Force interface. This implementation
16 /// calculates the interpolated value from a point cloud with force and
17 /// torque attributes attached to it.
19  public SIM_OptionsUser
20 {
21 public:
22  /// Scale the calculated force value.
24  /// Whether to sample by point, circle, or sphere.
26 
27 protected:
28  explicit SIM_ForceMagnet(const SIM_DataFactory *factory);
29  ~SIM_ForceMagnet() override;
30 
31  /// Returns the force and torque on a point. The returned values are
32  /// exact copies of the force and torque attributes. The
33  /// getForceOnCircleSubclass() and getForceOnSphereSubclass()
34  /// functions use the default implementations which scale the point
35  /// force by the area or volume of the circle or sphere. This means
36  /// that regardless of the size of samples used to quantize an object,
37  /// the total force on the object should remain roughly constant.
38  void getForceSubclass(
39  const SIM_Object &object,
40  const UT_Vector3 &position,
41  const UT_Vector3 &velocity,
42  const UT_Vector3 &angvel,
43  const fpreal mass,
45  UT_Vector3 &torque) const override;
46 
48 
49  /// Override this to return a SIM_GuideShared so we only have to draw
50  /// our guide geometry once regardless of how many objects we are
51  /// attached to.
52  SIM_Guide *createGuideObjectSubclass() const override;
53  /// Build guide geometry by copying the points from the source geometry,
54  /// and adding lines to represent the force and torque vectors.
56  const SIM_RootData &root,
57  const SIM_Options &options,
58  const GU_DetailHandle &gdh,
59  UT_DMatrix4 *xform,
60  const SIM_Time &t) const override;
61 
62 private:
63  static const SIM_DopDescription *getForceMagnetDopDescription();
64 
65  // Builds the transform which goes from the geometry space to the
66  // world space.
67  void getGeometryToWorldTransform(UT_DMatrix4 &xform) const;
68  // Builds the inverse transform which moves the world space into
69  // the geometry space.
70  void getWorldToGeometryTransform(UT_DMatrix4 &xform) const;
71 
74  SIM_Force,
75  "Magnet Force",
76  getForceMagnetDopDescription());
77 };
78 
79 #endif
80 
virtual void getForceSubclass(const SIM_Object &object, const UT_Vector3 &position, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:50
SIM_API const UT_StringHolder torque
SIM_ForceSample
Definition: SIM_Force.h:49
#define GETSET_DATA_FUNCS_F(DataName, FuncName)
#define SIM_NAME_SAMPLEMODE
Definition: SIM_Names.h:181
virtual void buildGuideGeometrySubclass(const SIM_RootData &root, const SIM_Options &options, const GU_DetailHandle &gdh, UT_DMatrix4 *xform, const SIM_Time &t) const
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
virtual SIM_ForceSample getOptimalForceSamplingSubclass() const
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
#define SIM_NAME_FORCESCALE
Definition: SIM_Names.h:125
GLdouble t
Definition: glad.h:2397
GA_API const UT_StringHolder mass
SIM_API const UT_StringHolder force
fpreal64 fpreal
Definition: SYS_Types.h:277
SIM_API const UT_StringHolder position
#define SIM_API
Definition: SIM_API.h:12
virtual SIM_Guide * createGuideObjectSubclass() const