Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HUtilityGeometryCreation.h
00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc.
00002 //
00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
00004 // and considered a trade secret as defined under civil and criminal statutes.
00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
00006 // unauthorized use or misappropriation of its trade secrets.  Use of this information
00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
00009 
00010 #ifndef _HUTILITYGEOMETRYCREATION_H
00011 #define _HUTILITYGEOMETRYCREATION_H
00012 
00013 #ifdef H_PACK_8
00014 #pragma pack(push)
00015 #pragma pack(8)
00016 #endif
00017 
00018 #include "HTools.h"
00019 #include "HUtility.h"
00020 #include "varray.h"
00021 #include <map>
00022 
00023 #define BOOLEAN_TYPE_NONE       0
00024 #define BOOLEAN_TYPE_INTERSECT  1
00025 #define BOOLEAN_TYPE_SUBTRACT   2
00026 #define BOOLEAN_TYPE_UNION      3
00027 
00028 class Vertex_List_Node
00029 {
00030 public:
00031     Vertex_List_Node() : next(0) {
00032     };
00033 
00034     ~Vertex_List_Node(){
00035     };
00036 
00037     int ID;
00038     HPoint point;
00039     HPoint color_value;
00040     float color_findex;
00041     HPoint normal;
00042     VArray<float> params;
00043 
00044     VArray<int> in_face_array;
00045     int in_face_current;
00046 
00047     Vertex_List_Node * next;
00048 };
00049 
00050 typedef std::multimap<int, Vertex_List_Node *>::iterator nodes_iterator;
00051 
00053 class MVO_API HUtilityGeometryCreation
00054 {
00055 public:
00056 
00069     static bool GeneratePointOnCircle(HPoint * point, HPoint const & center, float radius, int axis, float angle, bool convert=true);
00070     
00083     static bool GeneratePointsOnCircle (HPoint points[], HPoint const & center, float radius, int axis, int numpoints, bool convert=true);
00084 
00085 
00100     static bool GeneratePointsOnCircularArc (HPoint points[], HPoint const & center, float radius, int axis, int numpoints, bool convert, float start_angle, float end_angle);
00101 
00109     static HC_KEY CreateWireframeCircleWithEllipse(const HPoint &x1, const HPoint &x2, const HPoint &x3 ) ;
00110 
00119     static HC_KEY CreateSphere(const char * segment, HPoint center, float radius, int num_faces);
00120   
00131     static HC_KEY CreateSphere(HPoint center, float radius, int numsides, HPoint axis, HPoint ref);
00132     
00144     static HC_KEY CreateCone(HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref);
00145     
00157     static HC_KEY CreateCylinder(HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref);
00158     
00167     static HC_KEY CreateCuboid( HPoint const * max, HPoint const * min);
00168 
00170     static void SetupModellingMatrix(HVector axis, HVector ref, HVector side, HPoint pos);
00171 
00178     static HC_KEY CreateCuttingPlane(HBaseView *view, const char *segmentname = 0, bool createplane = true);
00179 
00180 
00181 
00187      static void SetCuttingPlaneVisibilityForAll(HC_KEY startkey, const char *visibility);
00188 
00195     static void AdjustCuttingPlaneRendering(HBaseView * view);
00196 
00202     static void AdjustSection(HBaseView *view, HC_KEY key);
00203 
00208     static void CreateThreeSidedSection(HBaseView *view);
00209 
00214     static void CreateTwoSidedSection(HBaseView *view);
00215     static void CreateSlice(HBaseView *view, float relative_thickness = 0.1f);
00216 
00238     static HC_KEY CreateShellWithFaceSpecificVertexAttributes(
00239         float points[],
00240         int face_list_length, int face_vertex_indices[],
00241         float normals[]=0, int per_face_vertex_normal_indices[]=0,
00242         float color_values[]=0, int per_face_vertex_color_value_indices[]=0,
00243         float color_findices[]=0, int per_face_vertex_color_findex_indices[]=0,
00244         float params[]=0, int per_face_vertex_param_indices[]=0, int param_number=0,
00245         float crease_angle = 0.f);
00246 
00247 #ifndef SWIG
00248 
00269     static HC_KEY CreateShellWithFaceSpecificVertexAttributes(
00270         HPoint points[],
00271         int face_list_length, int face_vertex_indices[],
00272         HPoint normals[]=0, int per_face_vertex_normal_indices[]=0,
00273         HPoint color_values[]=0, int per_face_vertex_color_value_indices[]=0,
00274         float color_findices[]=0, int per_face_vertex_color_findex_indices[]=0,
00275         float params[]=0, int per_face_vertex_param_indices[]=0, int param_number=0,
00276         float crease_angle = 0.f);
00277 #endif
00278 
00287     static HC_KEY GenerateFEAShell( HC_KEY definingShell, bool generateIsolines, const char *algorithm);
00288 
00298     static HC_KEY CreateSmoothedShell(
00299         int PointCount, 
00300         const HPoint Points[], 
00301         int FaceListLength, 
00302         const int FaceList[], 
00303         float creaseAngle);
00304 
00323     static bool ComputeFIndexDemoData(HShellVertexData *pShellVertexData, int data_cycles = 30);
00324 
00325     
00338     static HC_KEY CreateBoolean(HC_KEY target, HC_KEY tool, int bool_type);
00339 
00359     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);
00360 
00361 
00376     static HC_KEY CreateShellFromPathSweep(int nProfilePoints, const HPoint pOuterProfilePoints[], const HPoint pInnerProfilePoints[], int nPathPoints, const HPoint pSweepPathPoints[], const bool bIsProfileClosed);
00377 
00378 private:
00379 
00380     /* 
00381       GenerateCuboidPoints creates the vertices of a cuboid based on two input points.
00382       NOTE: I have to generate extra points here for each corner so that the 
00383       block appear to be flat shaded even in Goroud shading mode which is the only
00384       realistic appearance for blocks - Rajesh B (16-Feb-01)
00385       \param max A pointer to an HPoint object.
00386       \param min A pointer to an HPoint object.
00387       \param points A pointer to an array of HPoint objects.  Passed by reference.
00388     */
00389     static void GenerateCuboidPoints( HPoint const * max, HPoint const * in, HPoint points[]);
00390 
00391 
00392  
00393 };
00394 
00395 #ifdef H_PACK_8
00396 #pragma pack(pop)
00397 #endif
00398 
00399 #endif
00400 
00401 
00402 
00403 
00404