00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id$ 00013 // 00014 #ifndef _HUTILITYGEOMETRYCREATION_H 00015 #define _HUTILITYGEOMETRYCREATION_H 00016 00017 #ifdef H_PACK_8 00018 #pragma pack(push) 00019 #pragma pack(8) 00020 #endif 00021 00022 #include "HTools.h" 00023 #include "HUtility.h" 00024 #include "varray.h" 00025 #include <map> 00026 00027 #define BOOLEAN_TYPE_NONE 0 00028 #define BOOLEAN_TYPE_INTERSECT 1 00029 #define BOOLEAN_TYPE_SUBTRACT 2 00030 #define BOOLEAN_TYPE_UNION 3 00031 00032 class Vertex_List_Node 00033 { 00034 public: 00035 Vertex_List_Node() : next(0) { 00036 }; 00037 00038 ~Vertex_List_Node(){ 00039 }; 00040 00041 int ID; 00042 HPoint point; 00043 HPoint color_value; 00044 float color_findex; 00045 HPoint normal; 00046 VArray<float> params; 00047 00048 VArray<int> in_face_array; 00049 int in_face_current; 00050 00051 Vertex_List_Node * next; 00052 }; 00053 00054 typedef std::multimap<int, Vertex_List_Node *>::iterator nodes_iterator; 00055 00057 class MVO_API HUtilityGeometryCreation 00058 { 00059 public: 00060 00073 static bool GeneratePointOnCircle(HPoint * point, HPoint const & center, float radius, int axis, float angle, bool convert=true); 00074 00087 static bool GeneratePointsOnCircle (HPoint points[], HPoint const & center, float radius, int axis, int numpoints, bool convert=true); 00088 00089 00104 static bool GeneratePointsOnCircularArc (HPoint points[], HPoint const & center, float radius, int axis, int numpoints, bool convert, float start_angle, float end_angle); 00105 00113 static HC_KEY CreateWireframeCircleWithEllipse(const HPoint &x1, const HPoint &x2, const HPoint &x3 ) ; 00114 00123 static HC_KEY CreateSphere(const char * segment, HPoint center, float radius, int num_faces); 00124 00135 static HC_KEY CreateSphere(HPoint center, float radius, int numsides, HPoint axis, HPoint ref); 00136 00148 static HC_KEY CreateCone(HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref); 00149 00161 static HC_KEY CreateCylinder(HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref); 00162 00171 static HC_KEY CreateCuboid( HPoint * max, HPoint * min); 00172 00174 static void SetupModellingMatrix(HVector axis, HVector ref, HVector side, HPoint pos); 00175 00182 static HC_KEY CreateCuttingPlane(HBaseView *view, const char *segmentname = 0, bool createplane = true); 00183 00184 00185 00191 static void SetCuttingPlaneVisibilityForAll(HC_KEY startkey, const char *visibility); 00192 00199 static void AdjustCuttingPlaneRendering(HBaseView * view); 00200 00206 static void AdjustSection(HBaseView *view, HC_KEY key); 00207 00212 static void CreateThreeSidedSection(HBaseView *view); 00213 00218 static void CreateTwoSidedSection(HBaseView *view); 00219 static void CreateSlice(HBaseView *view, float relative_thickness = 0.1f); 00220 00242 static HC_KEY CreateShellWithFaceSpecificVertexAttributes( 00243 float *points, 00244 int face_list_length, int *face_vertex_indices, 00245 float *normals=0, int *per_face_vertex_normal_indices=0, 00246 float *color_values=0, int *per_face_vertex_color_value_indices=0, 00247 float *color_findices=0, int *per_face_vertex_color_findex_indices=0, 00248 float *params=0, int *per_face_vertex_param_indices=0, int param_number=0, 00249 float crease_angle = 0.f); 00250 00251 #ifndef SWIG 00252 00273 static HC_KEY CreateShellWithFaceSpecificVertexAttributes( 00274 HPoint points[], 00275 int face_list_length, int *face_vertex_indices, 00276 HPoint normals[]=0, int *per_face_vertex_normal_indices=0, 00277 HPoint color_values[]=0, int *per_face_vertex_color_value_indices=0, 00278 float *color_findices=0, int *per_face_vertex_color_findex_indices=0, 00279 float *params=0, int *per_face_vertex_param_indices=0, int param_number=0, 00280 float crease_angle = 0.f); 00281 #endif 00282 00291 static HC_KEY GenerateFEAShell( HC_KEY definingShell, bool generateIsolines, const char *algorithm); 00292 00302 static HC_KEY CreateSmoothedShell( 00303 int PointCount, 00304 const HPoint Points[], 00305 int FaceListLength, 00306 const int *FaceList, 00307 float creaseAngle); 00308 00327 static bool ComputeFIndexDemoData(HShellVertexData *pShellVertexData, int data_cycles = 30); 00328 00329 00342 static HC_KEY CreateBoolean(HC_KEY target, HC_KEY tool, int bool_type); 00343 00363 static HC_KEY CreateShellFromRotationalSweep(int nPoints, const HPoint profile[], const float *radii, float start_angle, float end_angle, int axis, const bool *hard, int n_sides); 00364 00365 00380 static HC_KEY CreateShellFromPathSweep(int nProfilePoints, const HPoint pOuterProfilePoints[], const HPoint pInnerProfilePoints[], int nPathPoints, const HPoint pSweepPathPoints[], const bool bIsProfileClosed); 00381 00382 private: 00383 00384 /* 00385 GenerateCuboidPoints creates the vertices of a cuboid based on two input points. 00386 NOTE: I have to generate extra points here for each corner so that the 00387 block appear to be flat shaded even in Goroud shading mode which is the only 00388 realistic appearance for blocks - Rajesh B (16-Feb-01) 00389 \param max A pointer to an HPoint object. 00390 \param min A pointer to an HPoint object. 00391 \param points A pointer to an array of HPoint objects. Passed by reference. 00392 */ 00393 static void GenerateCuboidPoints( HPoint * max, HPoint * in, HPoint points[]); 00394 00395 00396 00397 }; 00398 00399 #ifdef H_PACK_8 00400 #pragma pack(pop) 00401 #endif 00402 00403 #endif 00404 00405 00406 00407 00408