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: 63158c38b524b90a350dc56a7ef6c9c55312bae4 $ 00013 // 00014 00015 // HCuttingPlaneLinedata.h : interface of the HCuttingPlaneLinedata class 00016 // 00017 // supports creation of linked list of polylines which represent the lines 00018 // of intersection with a cutting plane. supports insertion of these lines 00019 // into a segment within the scene in HBaseView 00020 00025 #ifndef _HIM_CUTTING_GEOMETRY_H 00026 #define _HIM_CUTTING_GEOMETRY_H 00027 00028 #ifdef H_PACK_8 00029 #pragma pack(push) 00030 #pragma pack(8) 00031 #endif 00032 00033 #include "HTools.h" 00034 #include "hic_types.h" 00035 00039 enum HIMCG_Cutting_Type { 00040 HIM_CUTTING_GEOMETRY_TYPE_LINES = 0, 00041 HIM_CUTTING_GEOMETRY_TYPE_POLYLINES = 0x1, 00042 HIM_CUTTING_GEOMETRY_TYPE_FACES = 0x2 00043 }; 00048 enum HIMCG_Body_Type { 00049 HIM_CUTTING_GEOMETRY_SEGMENT_BODY = 1, 00050 HIM_CUTTING_GEOMETRY_SHELL_BODY = 2 00051 }; 00052 00053 00124 class MVO_API HImCuttingGeometry 00125 { 00126 public: 00128 HImCuttingGeometry(); 00129 ~HImCuttingGeometry(); 00130 00144 void CreateCuttingGeometry(HC_KEY source_key, HC_KEY target_key, 00145 int cutting_type=HIM_CUTTING_GEOMETRY_TYPE_POLYLINES, 00146 int body_level=HIM_CUTTING_GEOMETRY_SEGMENT_BODY); 00147 00153 void CreateCuttingGeometry(HC_KEY source_key, HC_KEY target_key, bool honor_modelling_matrices); 00154 00157 static void RegisterCallbacks(); 00158 00161 void SetSmallestFeature(float smallest_feature) { m_smallest_feature = smallest_feature; } 00163 float GetSmallestFeature() { return m_smallest_feature; } 00168 void SetTolerance(float tolerance) { m_tolerance = tolerance; } 00171 float GetTolerance() { return m_tolerance; } 00172 00173 private: 00174 00175 /* Collects all of the cutting lines into a list. This list can either be directly displayed as a collection 00176 of lines, or merged into a closed loop for the purposes of computing a capping polygon. */ 00177 static void StoreCuttingPlaneLines (HIC_Rendition const *nr, int count, HIC_DC_Point const * pts); 00178 /* If we are computing capping polygon(s), this routine will allow us to determine when one body stops 00179 and the next begins. */ 00180 static void StopBody (HIC_Rendition const *nr); 00181 /* calls straight through to StopBody (see above) */ 00182 static void ShellBody (HIC_Rendition const *nr, HIC_Polyhedron const *phon); 00183 /* calls straight through to StopBody (see above) */ 00184 static void SegmentBody (HIC_Rendition const *nr, HIC_Segment_Info const *seg); 00185 00186 /* does the actual work for the new CreateCuttingGeometry */ 00187 static void GetCaps(HIC_Rendition const *nr, HIC_Polyhedron const *p); 00188 00189 /* tracks whether we cook to lines, polylines, or faces. polylines and faces may be used together with a bitwise OR */ 00190 static int m_cutting_type; 00191 /* used only to set the handedness of the cutting geometry segment */ 00192 static bool m_body_is_open; 00193 static float m_smallest_feature; 00194 /* the largest allowable distance between start and end to be considered a match for the purposes of 00195 assembling polylines and testing for closed loops */ 00196 static float m_tolerance; 00197 static struct vlist_s * m_lines; /* stores uncooked soup of lines */ 00198 static struct vlist_s * m_polylines; /* stores lines merged together where possible */ 00199 static struct vlist_s * m_faces; /* stores (probably closed) loops to be used as shell faces */ 00200 static HC_KEY m_target_segment; 00201 static bool m_honor_matrices; 00202 }; 00203 00204 00205 00206 #ifdef H_PACK_8 00207 #pragma pack(pop) 00208 #endif 00209 00210 #endif 00211 00212 00213 00214 00215 00216 00217 00218