00001 // rdTriangle.h 00002 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00003 // Copyright 2002 Realistic Dynamics, Inc. 00004 // All rights reserved. 00005 // 00006 // Please do not read, copy, distribute, or use without permission. 00007 // Contact: Frank C. Anderson, fca@RealisticDynamics.com 00008 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 #ifndef __rdTriangle_h__ 00010 #define __rdTriangle_h__ 00011 00012 // INCLUDES 00013 #include "rdTools.h" 00014 #include "rdObject.h" 00015 #include "rdLine.h" 00016 #include "rdVertices.h" 00017 00018 //============================================================================= 00019 //============================================================================= 00023 class RDTOOLS_API rdTriangle : public rdObject 00024 { 00025 //============================================================================= 00026 // DATA 00027 //============================================================================= 00028 public: 00029 enum INTERSECTION { NONE=0, 00030 POINT_INTERIOR, 00031 POINT_VERTEX0,POINT_VERTEX1,POINT_VERTEX2, 00032 POINT_EDGE01,POINT_EDGE12,POINT_EDGE20, 00033 LINE_INTERIOR, 00034 LINE_VERTEX0,LINE_VERTEX1,LINE_VERTEX2, 00035 LINE_EDGE01,LINE_EDGE12,LINE_EDGE20 }; 00036 private: 00037 rdVertices *_verts; 00038 char* _v3dNames[3]; 00039 int _v3dIndex[3]; 00040 00041 //============================================================================= 00042 // METHODS 00043 //============================================================================= 00044 public: 00045 //-------------------------------------------------------------------------- 00046 // CONSTRUCTION 00047 //-------------------------------------------------------------------------- 00048 rdTriangle(); 00049 rdTriangle(IDOM_Element *aElement); 00050 virtual ~rdTriangle(); 00051 private: 00052 void setNull(); 00053 00054 //-------------------------------------------------------------------------- 00055 // GET AND SET 00056 //-------------------------------------------------------------------------- 00057 public: 00058 void setVertices(rdVertices *aVertices); 00059 rdVertices* getVertices(); 00060 int getVertex(int aWhich,double rV[3]) const; 00061 int getVertexIndex(int aWhich) const; 00062 00063 //-------------------------------------------------------------------------- 00064 // UTILITIES 00065 //-------------------------------------------------------------------------- 00066 void computeLowerBounds(double rLower[3]) const; 00067 void computeUpperBounds(double rUpper[3]) const; 00068 INTERSECTION 00069 computeIntersection(const rdLine *aLine,double rP1[3],double rP2[3]) 00070 const; 00071 INTERSECTION 00072 computeIntersection(const double aP[3]) const; 00073 void 00074 updateIndicies(); 00075 00076 //-------------------------------------------------------------------------- 00077 // XML 00078 //-------------------------------------------------------------------------- 00079 virtual void updateObject(bool aDeep=true); 00080 virtual void updateNode(bool aDeep=true); 00081 void updateData(); 00082 00083 //============================================================================= 00084 }; // END class rdTriangle 00085 //============================================================================= 00086 //============================================================================= 00087 00088 #endif // __rdTriangle_h__
1.3