HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_Volume.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: Geometry Library (C++)
7  *
8  * COMMENTS:
9  * Calculates the volume inside or on the surface of a 2 or 3D object.
10  *
11  */
12 
13 #ifndef __GU_Volume_H__
14 #define __GU_Volume_H__
15 
16 #include "GU_API.h"
17 #include <UT/UT_Vector3.h>
18 #include <UT/UT_BoundingBox.h>
19 
20 class GU_Detail;
21 
23 {
24 public:
25  enum
26  {
28  SOLID_OBJECT
29  };
30 
31  GU_Volume(GU_Detail *geo, int divs,
32  int type = SOLID_OBJECT);
33  virtual ~GU_Volume();
34 
35  float getVolume();
36  UT_Vector3 getCenterOfMass();
37  float getMomentOfInertia(const UT_Vector3 &about,
38  const UT_Vector3 &axis,
39  float mass = 1.0F);
40 
41  UT_Vector3 getResistanceTorque(const UT_Vector3 &rotvel,
42  float resistance, int newtonmodel,
43  float scale);
44 
45  void DEBUGgetPoints(float *&pnts, int &num);
46 
47  UT_BoundingBox &getBoundingBox() { return myBounds; }
48 private:
49  void voxelize();
50  void voxelize2D();
51  void voxelize3D();
52 
53  void determineEdges();
54 
55  void scanlineIntersect(const UT_Vector3 &o, const UT_Vector3 &d,
56  int &numsections, float *pos, int *orient);
57 
58 private:
59  GU_Detail *myGeometry;
60  UT_BoundingBox myBounds;
61  int myDivisions;
62  int myObjectType;
63  int myIsVoxelized;
64  int myEdgesDetermined;
65  unsigned char *myVoxels;
66 
67  // cached stuff...
68  int myIsVolumeCalc;
69  float myVolume;
70  int myIsCOMCalc;
71  UT_Vector3 myCOM;
72 };
73 
74 #endif
virtual float getVolume(int speaker)
UT_BoundingBox & getBoundingBox()
Definition: GU_Volume.h:47
3D Vector class.
int divs(int x, int y)
Definition: ImathFun.h:180
GA_API const UT_StringHolder scale
#define GU_API
Definition: GU_API.h:12
GA_API const UT_StringHolder orient
GA_API const UT_StringHolder mass
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
png_infop png_uint_32 int num
Definition: png.h:2158