| 1 | //- Class: BoundingBoxTool |
|---|
| 2 | //- Description: Class for bounding boxes (primarily for "tight" bounding boxes) |
|---|
| 3 | //- Owner: Steve Storm |
|---|
| 4 | //- Created: 06-October-2000 |
|---|
| 5 | |
|---|
| 6 | #ifndef BoundingBoxTool_HPP |
|---|
| 7 | #define BoundingBoxTool_HPP |
|---|
| 8 | |
|---|
| 9 | #include "CubitDefines.h" |
|---|
| 10 | #include "CubitGeomConfigure.h" |
|---|
| 11 | |
|---|
| 12 | class GMem; |
|---|
| 13 | class CubitVector; |
|---|
| 14 | class RefEntity; |
|---|
| 15 | |
|---|
| 16 | class CUBIT_GEOM_EXPORT BoundingBoxTool |
|---|
| 17 | { |
|---|
| 18 | |
|---|
| 19 | public : |
|---|
| 20 | |
|---|
| 21 | static CubitStatus get_tight_bounding_box( DLIList<RefEntity*> &ref_entity_list, |
|---|
| 22 | CubitVector ¢er, |
|---|
| 23 | CubitVector axes[3], |
|---|
| 24 | CubitVector &extension, |
|---|
| 25 | double ang_facet_tol, |
|---|
| 26 | double abs_facet_tol); |
|---|
| 27 | //- Gets tightest box around the given entity list, using facets. |
|---|
| 28 | //- Box is defined as center point, vector axes (unit vectors), and |
|---|
| 29 | //- extension in each axis (x extension is 1/2 width of box, for example). |
|---|
| 30 | |
|---|
| 31 | static CubitStatus get_axis_bounding_box( DLIList<RefEntity*> &ref_entity_list, |
|---|
| 32 | CubitVector ¢er, |
|---|
| 33 | CubitVector axes[3], |
|---|
| 34 | CubitVector &extension ); |
|---|
| 35 | //- Convenience function to get an axis box in the same output format as |
|---|
| 36 | //- a tight box. |
|---|
| 37 | |
|---|
| 38 | static CubitStatus get_corner_points( CubitVector ¢er, |
|---|
| 39 | CubitVector axes[3], |
|---|
| 40 | CubitVector &extension, |
|---|
| 41 | CubitVector& p1, CubitVector& p2, |
|---|
| 42 | CubitVector& p3, CubitVector& p4, |
|---|
| 43 | CubitVector& p5, CubitVector& p6, |
|---|
| 44 | CubitVector& p7, CubitVector& p8); |
|---|
| 45 | //- Using the center, axes and extension, gets the 8 corners of the box. |
|---|
| 46 | |
|---|
| 47 | static CubitBoolean get_use_triangles(); |
|---|
| 48 | static void set_use_triangles( CubitBoolean val ); |
|---|
| 49 | //- If triangles are used, surface facet points will be included in |
|---|
| 50 | //- the point list used to calculate the tight bounding box. This |
|---|
| 51 | //- will include vertices and points on the curves. This is the |
|---|
| 52 | //- default implementation. |
|---|
| 53 | static int get_use_triangles_setting(); |
|---|
| 54 | static void set_use_triangles_setting( int val ); |
|---|
| 55 | |
|---|
| 56 | static CubitBoolean get_use_curves(); |
|---|
| 57 | static void set_use_curves( CubitBoolean val ); |
|---|
| 58 | //- If curves are used, curve tesselation points will be included in |
|---|
| 59 | //- the point list used to calculate the tight bounding box. This |
|---|
| 60 | //- includes the vertices on the ends of the curves. One use for this |
|---|
| 61 | //- is to find a more accurate tight bounding box, since curve |
|---|
| 62 | //- tessellations are typically more fine than surface tessellations. |
|---|
| 63 | //- However, in practice, I would generally recommend just using surface |
|---|
| 64 | //- tessellations. One special case is if the user sends in a list of |
|---|
| 65 | //- curves as the criteria for the tight bounding box, the curve |
|---|
| 66 | //- tessellations are always used, even if this parameter is false. |
|---|
| 67 | static int get_use_curves_setting(); |
|---|
| 68 | static void set_use_curves_setting( int val ); |
|---|
| 69 | |
|---|
| 70 | static CubitBoolean get_use_vertices(); |
|---|
| 71 | static void set_use_vertices( CubitBoolean val ); |
|---|
| 72 | //- If vertices are used, vertex points will be included in the point |
|---|
| 73 | //- list used to calculate the tight bounding box. In extremely large |
|---|
| 74 | //- models, it could be advantageous to just use vertices. So the user |
|---|
| 75 | //- would turn off both the surface and curve flags. One special case |
|---|
| 76 | //- is if the user sends in a list of curves as the criteria for the |
|---|
| 77 | //- tight bounding box, the curve tessellations are always used, even |
|---|
| 78 | //- if the curve parameter is false and this parameter is true. |
|---|
| 79 | static int get_use_vertices_setting(); |
|---|
| 80 | static void set_use_vertices_setting( int val ); |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | //Initialize all settings in this class |
|---|
| 84 | static void initialize_settings(); |
|---|
| 85 | |
|---|
| 86 | protected : |
|---|
| 87 | |
|---|
| 88 | ~BoundingBoxTool(); |
|---|
| 89 | //- Destructor. |
|---|
| 90 | |
|---|
| 91 | BoundingBoxTool(); |
|---|
| 92 | //- Constructor for the BoundingBoxTool object |
|---|
| 93 | |
|---|
| 94 | private : |
|---|
| 95 | |
|---|
| 96 | static CubitStatus append_ref_entity_points( DLIList<RefEntity*> &ref_entity_list, |
|---|
| 97 | DLIList<CubitVector*> &vec_list, |
|---|
| 98 | double ang_tol, double abs_tol); |
|---|
| 99 | static CubitStatus append_body_points( DLIList<Body*> &body_list, |
|---|
| 100 | DLIList<CubitVector*> &vec_list, |
|---|
| 101 | double ang_tol, double abs_tol ); |
|---|
| 102 | static CubitStatus append_volume_points( DLIList<RefVolume*> &vol_list, |
|---|
| 103 | DLIList<CubitVector*> &vec_list, |
|---|
| 104 | double ang_tol, double abs_tol ); |
|---|
| 105 | static CubitStatus append_curve_points( DLIList<RefEdge*> &ref_edge_list, |
|---|
| 106 | DLIList<CubitVector*> &vec_list ); |
|---|
| 107 | static CubitStatus append_vertex_points( DLIList<RefVertex*> &ref_vertex_list, |
|---|
| 108 | DLIList<CubitVector*> &vec_list ); |
|---|
| 109 | static CubitStatus append_surface_points( DLIList<RefFace*> &ref_face_list, |
|---|
| 110 | DLIList<CubitVector*> &vec_list, |
|---|
| 111 | double ang_tol, double abs_tol ); |
|---|
| 112 | //- The "append" functions allocate memory for the vectors which |
|---|
| 113 | //- must be freed by the calling code. |
|---|
| 114 | |
|---|
| 115 | static CubitBoolean expand_groups_in_list( DLIList<RefEntity*> &ref_entity_list ); |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | static CubitBoolean useTriangles; |
|---|
| 119 | static CubitBoolean useCurves; |
|---|
| 120 | static CubitBoolean useVertices; |
|---|
| 121 | }; |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | #endif |
|---|
| 126 | |
|---|
| 127 | |
|---|