HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_ForceImpulse.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  * NAME: SIM_ForceImpulse.h ( SIM Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __SIM_ForceImpulse__
12 #define __SIM_ForceImpulse__
13 
14 #include "SIM_API.h"
15 #include "SIM_Force.h"
16 #include "SIM_OptionsUser.h"
17 
18 /// This is an implementation of the SIM_Force interface. This
19 /// implementation returns a force value that is scaled by the timestep
20 /// of the simulation.
22  public SIM_OptionsUser
23 {
24 public:
25  /// Controls the magnitude and direction of the impulse.
26  GETSET_DATA_FUNCS_V3("impulse", Impulse);
27  /// Whether to sample by point, circle, or sphere.
29 
30 protected:
31  explicit SIM_ForceImpulse(const SIM_DataFactory *factory);
32  ~SIM_ForceImpulse() override;
33 
34  /// Calculates the impulse on a point. This force will be scaled
35  /// by the timestep & optionally by the mass.
36  void getForceSubclass(const SIM_Object &object,
37  const UT_Vector3 &position,
38  const UT_Vector3 &velocity,
39  const UT_Vector3 &angvel,
40  const fpreal mass,
42  UT_Vector3 &torque) const override;
43 
45  const SIM_Object& object)
46  const override;
47 
48  /// Calculates the impulse on a surface.
49  /// This function simply calls getForceSubclass(), ignoring the circle
50  /// parameters.
51  void getForceOnCircleSubclass(const SIM_Object &object,
52  const UT_Vector3 &position,
53  const UT_Vector3 &normal,
54  const fpreal radius,
55  const UT_Vector3 &velocity,
56  const UT_Vector3 &angvel,
57  const fpreal mass,
58  UT_Vector3 &force,
59  UT_Vector3 &torque) const override;
60  /// Calculates the impulse on a volume.
61  /// This function simply calls getForceSubclass(), ignoring the sphere
62  /// parameters.
63  void getForceOnSphereSubclass(const SIM_Object &object,
64  const UT_Vector3 &position,
65  const fpreal radius,
66  const UT_Vector3 &velocity,
67  const UT_Vector3 &angvel,
68  const fpreal mass,
69  UT_Vector3 &force,
70  UT_Vector3 &torque) const override;
71 
73 
74 private:
75  static const SIM_DopDescription *getForceImpulseDopDescription();
76 
79  SIM_Force,
80  "Impulse Force",
81  getForceImpulseDopDescription());
82 };
83 
84 #endif
85 
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
virtual void getForceOnSphereSubclass(const SIM_Object &object, const UT_Vector3 &position, const fpreal radius, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const
SIM_API const UT_StringHolder torque
SIM_ForceSample
Definition: SIM_Force.h:49
#define SIM_NAME_SAMPLEMODE
Definition: SIM_Names.h:181
#define GETSET_DATA_FUNCS_V3(DataName, FuncName)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:63
virtual void getForceOnCircleSubclass(const SIM_Object &object, const UT_Vector3 &position, const UT_Vector3 &normal, const fpreal radius, const UT_Vector3 &velocity, const UT_Vector3 &angvel, const fpreal mass, UT_Vector3 &force, UT_Vector3 &torque) const
virtual SIM_ForceSample getOptimalForceSamplingSubclass() const
virtual SIM_ForceResolver * getForceResolverSubclass(const SIM_Object &object) const
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
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