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  virtual ~SIM_ForceMagnet();
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  virtual void getForceSubclass(const SIM_Object &object,
39  const UT_Vector3 &position,
40  const UT_Vector3 &velocity,
41  const UT_Vector3 &angvel,
42  const fpreal mass,
43  UT_Vector3 &force,
44  UT_Vector3 &torque) const;
45 
47 
48  /// Override this to return a SIM_GuideShared so we only have to draw
49  /// our guide geometry once regardless of how many objects we are
50  /// attached to.
51  virtual SIM_Guide *createGuideObjectSubclass() const;
52  /// Build guide geometry by copying the points from the source geometry,
53  /// and adding lines to represent the force and torque vectors.
54  virtual void buildGuideGeometrySubclass(const SIM_RootData &root,
55  const SIM_Options &options,
56  const GU_DetailHandle &gdh,
57  UT_DMatrix4 *xform,
58  const SIM_Time &t) const;
59 
60 private:
61  static const SIM_DopDescription *getForceMagnetDopDescription();
62 
63  // Builds the transform which goes from the geometry space to the
64  // world space.
65  void getGeometryToWorldTransform(UT_DMatrix4 &xform) const;
66  // Builds the inverse transform which moves the world space into
67  // the geometry space.
68  void getWorldToGeometryTransform(UT_DMatrix4 &xform) const;
69 
72  SIM_Force,
73  "Magnet Force",
74  getForceMagnetDopDescription());
75 };
76 
77 #endif
78 
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:45
SIM_ForceSample
Definition: SIM_Force.h:49
#define GETSET_DATA_FUNCS_F(DataName, FuncName)
#define SIM_NAME_SAMPLEMODE
Definition: SIM_Names.h:180
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:58
virtual SIM_ForceSample getOptimalForceSamplingSubclass() const
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
#define SIM_NAME_FORCESCALE
Definition: SIM_Names.h:124
GA_API const UT_StringHolder mass
double fpreal
Definition: SYS_Types.h:270
#define SIM_API
Definition: SIM_API.h:10
virtual SIM_Guide * createGuideObjectSubclass() const