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     ~Vertex_List_Node() {}
00034 
00035     int ID;
00036     HPoint point;
00037     HPoint color_value;
00038     float color_findex;
00039     HPoint normal;
00040     VArray<float> params;
00041 
00042     VArray<int> in_face_array;
00043     int in_face_current;
00044 
00045     Vertex_List_Node * next;
00046 };
00047 
00048 typedef std::multimap<int, Vertex_List_Node *>::iterator nodes_iterator;
00049 
00051 class MVO_API HUtilityGeometryCreation
00052 {
00053 public:
00054 
00067     static bool GeneratePointOnCircle(HPoint * point, HPoint const & center, float radius, int axis, float angle, bool convert=true);
00068     
00081     static bool GeneratePointsOnCircle (HPoint points[], HPoint const & center, float radius, int axis, int numpoints, bool convert=true);
00082 
00083 
00098     static bool GeneratePointsOnCircularArc (HPoint points[], HPoint const & center, float radius, int axis, int numpoints, bool convert, float start_angle, float end_angle);
00099 
00107     static HC_KEY CreateWireframeCircleWithEllipse(const HPoint &x1, const HPoint &x2, const HPoint &x3 ) ;
00108 
00117     static HC_KEY CreateSphere(const char * segment, HPoint center, float radius, int num_faces);
00118   
00129     static HC_KEY CreateSphere(HPoint center, float radius, int numsides, HPoint axis, HPoint ref);
00130     
00142     static HC_KEY CreateCone(HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref);
00143     
00155     static HC_KEY CreateCylinder(HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref);
00156     
00165     static HC_KEY CreateCuboid( HPoint const * max, HPoint const * min);
00166 
00168     static void SetupModellingMatrix(HVector axis, HVector ref, HVector side, HPoint pos);
00169 
00176     static HC_KEY CreateCuttingPlane(HBaseView *view, const char *segmentname = 0, bool createplane = true);
00177 
00178 
00179 
00185      static void SetCuttingPlaneVisibilityForAll(HC_KEY startkey, const char *visibility);
00186 
00193     static void AdjustCuttingPlaneRendering(HBaseView * view);
00194 
00200     static void AdjustSection(HBaseView *view, HC_KEY key);
00201 
00206     static void CreateThreeSidedSection(HBaseView *view);
00207 
00212     static void CreateTwoSidedSection(HBaseView *view);
00213     static void CreateSlice(HBaseView *view, float relative_thickness = 0.1f);
00214 
00236     static HC_KEY CreateShellWithFaceSpecificVertexAttributes(
00237         float points[],
00238         int face_list_length, int face_vertex_indices[],
00239         float normals[]=0, int per_face_vertex_normal_indices[]=0,
00240         float color_values[]=0, int per_face_vertex_color_value_indices[]=0,
00241         float color_findices[]=0, int per_face_vertex_color_findex_indices[]=0,
00242         float params[]=0, int per_face_vertex_param_indices[]=0, int param_number=0,
00243         float crease_angle = 0.f);
00244 
00245 #ifndef SWIG
00246 
00267     static HC_KEY CreateShellWithFaceSpecificVertexAttributes(
00268         HPoint points[],
00269         int face_list_length, int face_vertex_indices[],
00270         HPoint normals[]=0, int per_face_vertex_normal_indices[]=0,
00271         HPoint color_values[]=0, int per_face_vertex_color_value_indices[]=0,
00272         float color_findices[]=0, int per_face_vertex_color_findex_indices[]=0,
00273         float params[]=0, int per_face_vertex_param_indices[]=0, int param_number=0,
00274         float crease_angle = 0.f);
00275 #endif
00276 
00285     static HC_KEY GenerateFEAShell( HC_KEY definingShell, bool generateIsolines, const char *algorithm);
00286 
00296     static HC_KEY CreateSmoothedShell(
00297         int PointCount, 
00298         const HPoint Points[], 
00299         int FaceListLength, 
00300         const int FaceList[], 
00301         float creaseAngle);
00302 
00321     static bool ComputeFIndexDemoData(HShellVertexData *pShellVertexData, int data_cycles = 30);
00322 
00323     
00336     static HC_KEY CreateBoolean(HC_KEY target, HC_KEY tool, int bool_type);
00337 
00357     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);
00358 
00359 
00374     static HC_KEY CreateShellFromPathSweep(int nProfilePoints, const HPoint pOuterProfilePoints[], const HPoint pInnerProfilePoints[], int nPathPoints, const HPoint pSweepPathPoints[], const bool bIsProfileClosed);
00375 
00376 private:
00377 
00378     /* 
00379       GenerateCuboidPoints creates the vertices of a cuboid based on two input points.
00380       NOTE: I have to generate extra points here for each corner so that the 
00381       block appear to be flat shaded even in Goroud shading mode which is the only
00382       realistic appearance for blocks - Rajesh B (16-Feb-01)
00383       \param max A pointer to an HPoint object.
00384       \param min A pointer to an HPoint object.
00385       \param points A pointer to an array of HPoint objects.  Passed by reference.
00386     */
00387     static void GenerateCuboidPoints( HPoint const * max, HPoint const * in, HPoint points[]);
00388 
00389 
00390  
00391 };
00392 
00393 #ifdef H_PACK_8
00394 #pragma pack(pop)
00395 #endif
00396 
00397 #endif
00398 
00399 
00400 
00401 
00402