HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_ForceFan.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_ForceFan_h__
9 #define __SIM_ForceFan_h__
10 
11 #include "SIM_API.h"
12 #include <UT/UT_DMatrix4.h>
13 #include "SIM_Force.h"
14 #include "SIM_OptionsUser.h"
15 
16 /// This is an implementation of the SIM_Force interface. This
17 /// implementation returns a force value that is scaled by the mass of
18 /// the object receiving the force. No torque is applied. This SIM_Data
19 /// subclass also implements the SIM_Geometry interface to provide a
20 /// visualization of the fan and the force it will generate.
22  public SIM_OptionsUser
23 {
24 public:
32  /// Whether to sample by point, circle, or sphere.
34 
35 protected:
36  explicit SIM_ForceFan(const SIM_DataFactory *factory);
37  ~SIM_ForceFan() override;
38 
39  /// Override the point force calculations. Since a fan inherently acts
40  /// on a surface, we assume for points that the point is a surface with
41  /// unit area.
42  void getForceSubclass(const SIM_Object &object,
43  const UT_Vector3 &position,
44  const UT_Vector3 &velocity,
45  const UT_Vector3 &angvel,
46  const fpreal mass,
47  UT_Vector3 &force,
48  UT_Vector3 &torque) const override;
49  /// Override the surface force calculation. This function calls
50  /// getForceSubclass() to get the force that would be applied to a
51  /// unit area, then scales this value by the area of the circle that
52  /// would be presented to the fan.
53  void getForceOnCircleSubclass(const SIM_Object &object,
54  const UT_Vector3 &position,
55  const UT_Vector3 &normal,
56  const fpreal radius,
57  const UT_Vector3 &velocity,
58  const UT_Vector3 &angvel,
59  const fpreal mass,
60  UT_Vector3 &force,
61  UT_Vector3 &torque) const override;
62 
64 
65  /// Override this to return a SIM_GuideStatic. The fan geometry is
66  /// always the same, only the transform changes.
67  SIM_Guide *createGuideObjectSubclass() const override;
68  /// We override this method to create the fan geometry.
70  const SIM_RootData &root,
71  const SIM_Options &options,
72  const GU_DetailHandle &gdh,
73  UT_DMatrix4 *xform,
74  const SIM_Time &t) const override;
75 
76 private:
77  /// This function massages the cone angle parameter value. It converts
78  /// it to radians, divides it by two (to represent the angle from the
79  /// centre of the cone to the edge), and verifies that the angle falls
80  /// into a valid range.
81  fpreal getAdjustedConeAngle() const;
82  /// This function massages the falloff cone angle value. It converts
83  /// it to radians, divides it by two, and ensures it fits within the
84  /// overall cone angle.
85  fpreal getAdjustedFalloffAngle(fpreal coneangle) const;
86 
87  /// Get the Automatic DOP description for creating a fan.
88  static const SIM_DopDescription *getForceFanDopDescription();
89 
92  SIM_Force,
93  "Fan Force",
94  getForceFanDopDescription());
95 };
96 
97 #endif
98 
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
#define SIM_NAME_FALLOFF
Definition: SIM_Names.h:115
#define SIM_NAME_DIRECTION
Definition: SIM_Names.h:102
#define SIM_NAME_MAXDISTANCE
Definition: SIM_Names.h:145
SIM_ForceSample
Definition: SIM_Force.h:49
#define GETSET_DATA_FUNCS_F(DataName, FuncName)
GLdouble GLdouble t
Definition: glew.h:1403
#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 GETSET_DATA_FUNCS_V3(DataName, FuncName)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
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
#define SIM_NAME_FALLOFFANGLE
Definition: SIM_Names.h:116
#define SIM_NAME_FLUX
Definition: SIM_Names.h:118
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
#define SIM_NAME_POSITION
Definition: SIM_Names.h:168
GA_API const UT_StringHolder mass
fpreal64 fpreal
Definition: SYS_Types.h:277
#define SIM_API
Definition: SIM_API.h:10
#define SIM_NAME_CONEANGLE
Definition: SIM_Names.h:93
virtual SIM_Guide * createGuideObjectSubclass() const