HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual ~SIM_ForceFan();
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  virtual 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;
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  virtual 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;
62 
64 
65  /// Override this to return a SIM_GuideStatic. The fan geometry is
66  /// always the same, only the transform changes.
67  virtual SIM_Guide *createGuideObjectSubclass() const;
68  /// We override this method to create the fan geometry.
69  virtual void buildGuideGeometrySubclass(const SIM_RootData &root,
70  const SIM_Options &options,
71  const GU_DetailHandle &gdh,
72  UT_DMatrix4 *xform,
73  const SIM_Time &t) const;
74 
75 private:
76  /// This function massages the cone angle parameter value. It converts
77  /// it to radians, divides it by two (to represent the angle from the
78  /// centre of the cone to the edge), and verifies that the angle falls
79  /// into a valid range.
80  fpreal getAdjustedConeAngle() const;
81  /// This function massages the falloff cone angle value. It converts
82  /// it to radians, divides it by two, and ensures it fits within the
83  /// overall cone angle.
84  fpreal getAdjustedFalloffAngle(fpreal coneangle) const;
85 
86  /// Get the Automatic DOP description for creating a fan.
87  static const SIM_DopDescription *getForceFanDopDescription();
88 
91  SIM_Force,
92  "Fan Force",
93  getForceFanDopDescription());
94 };
95 
96 #endif
97 
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:114
#define SIM_NAME_DIRECTION
Definition: SIM_Names.h:101
#define SIM_NAME_MAXDISTANCE
Definition: SIM_Names.h:144
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 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:115
#define SIM_NAME_FLUX
Definition: SIM_Names.h:117
#define GETSET_DATA_FUNCS_I(DataName, FuncName)
#define SIM_NAME_POSITION
Definition: SIM_Names.h:167
GA_API const UT_StringHolder mass
double fpreal
Definition: SYS_Types.h:269
#define SIM_API
Definition: SIM_API.h:10
#define SIM_NAME_CONEANGLE
Definition: SIM_Names.h:92
virtual SIM_Guide * createGuideObjectSubclass() const