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: f4486bd9e18744578493df189a56c7a94fce91a5 $ 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 00025 #define BOOLEAN_TYPE_NONE 0 00026 #define BOOLEAN_TYPE_INTERSECT 1 00027 #define BOOLEAN_TYPE_SUBTRACT 2 00028 #define BOOLEAN_TYPE_UNION 3 00029 00030 00032 class MVO_API HUtilityGeometryCreation 00033 { 00034 public: 00035 00048 static bool GeneratePointOnCircle(HPoint * point, HPoint const & center, float radius, int axis, float angle, bool convert=true); 00049 00062 static bool GeneratePointsOnCircle (HPoint points[], HPoint const & center, float radius, int axis, int numpoints, bool convert=true); 00063 00064 00079 static bool GeneratePointsOnCircularArc (HPoint points[], HPoint const & center, float radius, int axis, int numpoints, bool convert, float start_angle, float end_angle); 00080 00088 static HC_KEY CreateWireframeCircleWithEllipse(const HPoint &x1, const HPoint &x2, const HPoint &x3 ) ; 00089 00098 static HC_KEY CreateSphere(const char * segment, HPoint center, float radius, int num_faces); 00099 00110 static HC_KEY CreateSphere(HPoint center, float radius, int numsides, HPoint axis, HPoint ref); 00111 00123 static HC_KEY CreateCone(HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref); 00124 00136 static HC_KEY CreateCylinder(HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref); 00137 00146 static HC_KEY CreateCuboid( HPoint * max, HPoint * min); 00147 00149 static void SetupModellingMatrix(HVector axis, HVector ref, HVector side, HPoint pos); 00150 00157 static HC_KEY CreateCuttingPlane(HBaseView *view, const char *segmentname = 0, bool createplane = true); 00158 00159 00160 00166 static void SetCuttingPlaneVisibilityForAll(HC_KEY startkey, const char *visibility); 00167 00174 static void AdjustCuttingPlaneRendering(HBaseView * view); 00175 00181 static void AdjustSection(HBaseView *view, HC_KEY key); 00182 00187 static void CreateThreeSidedSection(HBaseView *view); 00188 00193 static void CreateTwoSidedSection(HBaseView *view); 00194 static void CreateSlice(HBaseView *view, float relative_thickness = 0.1f); 00195 00217 static HC_KEY CreateShellWithFaceSpecificVertexAttributes( 00218 float *points, 00219 int face_list_length, int *face_vertex_indices, 00220 float *normals=0, int *per_face_vertex_normal_indices=0, 00221 float *color_values=0, int *per_face_vertex_color_value_indices=0, 00222 float *color_findices=0, int *per_face_vertex_color_findex_indices=0, 00223 float *params=0, int *per_face_vertex_param_indices=0, int param_number=0, 00224 float crease_angle = 0.f); 00225 00226 #ifndef SWIG 00227 00248 static HC_KEY CreateShellWithFaceSpecificVertexAttributes( 00249 HPoint points[], 00250 int face_list_length, int *face_vertex_indices, 00251 HPoint normals[]=0, int *per_face_vertex_normal_indices=0, 00252 HPoint color_values[]=0, int *per_face_vertex_color_value_indices=0, 00253 float *color_findices=0, int *per_face_vertex_color_findex_indices=0, 00254 float *params=0, int *per_face_vertex_param_indices=0, int param_number=0, 00255 float crease_angle = 0.f); 00256 #endif 00257 00266 static HC_KEY GenerateFEAShell( HC_KEY definingShell, bool generateIsolines, const char *algorithm); 00267 00277 static HC_KEY CreateSmoothedShell( 00278 int PointCount, 00279 const HPoint Points[], 00280 int FaceListLength, 00281 const int *FaceList, 00282 float creaseAngle); 00283 00302 static bool ComputeFIndexDemoData(HShellVertexData *pShellVertexData, int data_cycles = 30); 00303 00304 00317 static HC_KEY CreateBoolean(HC_KEY target, HC_KEY tool, int bool_type); 00318 00338 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); 00339 00340 00355 static HC_KEY CreateShellFromPathSweep(int nProfilePoints, const HPoint pOuterProfilePoints[], const HPoint pInnerProfilePoints[], int nPathPoints, const HPoint pSweepPathPoints[], const bool bIsProfileClosed); 00356 00357 private: 00358 00359 /* 00360 GenerateCuboidPoints creates the vertices of a cuboid based on two input points. 00361 NOTE: I have to generate extra points here for each corner so that the 00362 block appear to be flat shaded even in Goroud shading mode which is the only 00363 realistic appearance for blocks - Rajesh B (16-Feb-01) 00364 \param max A pointer to an HPoint object. 00365 \param min A pointer to an HPoint object. 00366 \param points A pointer to an array of HPoint objects. Passed by reference. 00367 */ 00368 static void GenerateCuboidPoints( HPoint * max, HPoint * in, HPoint points[]); 00369 00370 00371 00372 }; 00373 00374 #ifdef H_PACK_8 00375 #pragma pack(pop) 00376 #endif 00377 00378 #endif 00379 00380 00381 00382 00383