00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GU_Volume_H__
00022 #define __GU_Volume_H__
00023
00024 #include "GU_API.h"
00025 #include <UT/UT_Vector3.h>
00026 #include <UT/UT_BoundingBox.h>
00027
00028 class GU_Detail;
00029
00030 class GU_API GU_Volume
00031 {
00032 public:
00033 enum {
00034 HOLLOW_OBJECT,
00035 SOLID_OBJECT
00036 };
00037
00038 GU_Volume(GU_Detail *geo, int divs,
00039 int type = SOLID_OBJECT);
00040 virtual ~GU_Volume();
00041
00042 float getVolume();
00043 UT_Vector3 getCenterOfMass();
00044 float getMomentOfInertia(const UT_Vector3 &about,
00045 const UT_Vector3 &axis,
00046 float mass = 1.0F);
00047
00048 UT_Vector3 getResistanceTorque(const UT_Vector3 &rotvel,
00049 float resistance, int newtonmodel,
00050 float scale);
00051
00052 void DEBUGgetPoints(float *&pnts, int &num);
00053
00054 UT_BoundingBox &getBoundingBox() { return myBounds; }
00055 private:
00056 void voxelize();
00057 void voxelize2D();
00058 void voxelize3D();
00059
00060 void determineEdges();
00061
00062 void scanlineIntersect(const UT_Vector3 &o, const UT_Vector3 &d,
00063 int &numsections, float *pos, int *orient);
00064
00065 private:
00066 GU_Detail *myGeometry;
00067 UT_BoundingBox myBounds;
00068 int myDivisions;
00069 int myObjectType;
00070 int myIsVoxelized;
00071 int myEdgesDetermined;
00072 unsigned char *myVoxels;
00073
00074
00075 int myIsVolumeCalc;
00076 float myVolume;
00077 int myIsCOMCalc;
00078 UT_Vector3 myCOM;
00079 };
00080
00081 #endif