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,
48  UT_Vector3 &torque) const override;
50  const SIM_Object &object)
51  const override;
52  /// Override the surface force calculation. This function calls
53  /// getForceSubclass() to get the force that would be applied to a
54  /// unit area, then scales this value by the area of the circle that
55  /// would be presented to the fan.
56  void getForceOnCircleSubclass(const SIM_Object &object,
57  const UT_Vector3 &position,
58  const UT_Vector3 &normal,
59  const fpreal radius,
60  const UT_Vector3 &velocity,
61  const UT_Vector3 &angvel,
62  const fpreal mass,
63  UT_Vector3 &force,
64  UT_Vector3 &torque) const override;
65 
67 
68  /// Override this to return a SIM_GuideStatic. The fan geometry is
69  /// always the same, only the transform changes.
70  SIM_Guide *createGuideObjectSubclass() const override;
71  /// We override this method to create the fan geometry.
73  const SIM_RootData &root,
74  const SIM_Options &options,
75  const GU_DetailHandle &gdh,
76  UT_DMatrix4 *xform,
77  const SIM_Time &t) const override;
78 
79 private:
80  /// This function massages the cone angle parameter value. It converts
81  /// it to radians, divides it by two (to represent the angle from the
82  /// centre of the cone to the edge), and verifies that the angle falls
83  /// into a valid range.
84  fpreal getAdjustedConeAngle() const;
85  /// This function massages the falloff cone angle value. It converts
86  /// it to radians, divides it by two, and ensures it fits within the
87  /// overall cone angle.
88  fpreal getAdjustedFalloffAngle(fpreal coneangle) const;
89 
90  /// Get the Automatic DOP description for creating a fan.
91  static const SIM_DopDescription *getForceFanDopDescription();
92 
95  SIM_Force,
96  "Fan Force",
97  getForceFanDopDescription());
98 };
99 
100 #endif
101 
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
#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_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 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
#define SIM_NAME_FALLOFFANGLE
Definition: SIM_Names.h:116
#define SIM_NAME_FLUX
Definition: SIM_Names.h:118
virtual SIM_ForceResolver * getForceResolverSubclass(const SIM_Object &object) const
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
GLdouble t
Definition: glad.h:2397
#define SIM_NAME_POSITION
Definition: SIM_Names.h:168
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
#define SIM_NAME_CONEANGLE
Definition: SIM_Names.h:93
virtual SIM_Guide * createGuideObjectSubclass() const