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