![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 #ifndef MOAB_BSP_TREE_POLY_HPP
00002 #define MOAB_BSP_TREE_POLY_HPP
00003
00004 #include "moab/Types.hpp"
00005 #include
00006
00007 namespace moab
00008 {
00009
00010 class CartVect;
00011
00012 /**\brief Convex polyhedron
00013 *
00014 * This class is used to represent the convex polyhedron that bounds
00015 * a node in a general plane-based BSP-tree.
00016 */
00017 class BSPTreePoly
00018 {
00019 public:
00020 struct Vertex;
00021 struct VertexUse;
00022 struct Edge;
00023 struct EdgeUse;
00024 struct Face;
00025
00026 private:
00027 Face* faceList;
00028
00029 void set_vertex_marks( int value );
00030
00031 BSPTreePoly( const BSPTreePoly& copy ); // not implemented
00032 BSPTreePoly& operator=( const BSPTreePoly& copy ); // not implemented
00033
00034 public:
00035 /**\brief Initialize as a planar-faced hexahedron
00036 *\param hex_corners Corner coordinates for a hexahedron, in Exodus/Patran order
00037 */
00038 BSPTreePoly( const CartVect hex_corners[8] ) : faceList( 0 )
00039 {
00040 set( hex_corners );
00041 }
00042 BSPTreePoly() : faceList( 0 ) {}
00043 ~BSPTreePoly()
00044 {
00045 clear();
00046 }
00047
00048 /**\brief Initialize as a planar-faced hexahedron
00049 *\param hex_corners Corner coordinates for a hexahedron, in Exodus/Patran order
00050 */
00051 ErrorCode set( const CartVect hex_corners[8] );
00052 void clear();
00053
00054 /**\brief Get handles for faces */
00055 void get_faces( std::vector< const Face* >& face_list ) const;
00056 /**\brief Get corner coordinates for a face */
00057 void get_vertices( const Face* face, std::vector< CartVect >& vertices ) const;
00058
00059 /** Intersect a plane with a polyhedron, retaining
00060 * the portion of the polyhedron below the plane.
00061 * This will fail if polyhedron is not convex.
00062 */
00063 bool cut_polyhedron( const CartVect& plane_normal, double plane_coeff );
00064
00065 /** Test if a point is contained in the polyhedron.
00066 *
00067 *\NOTE algorithm assumes *convex* polyhedron.
00068 */
00069 bool is_point_contained( const CartVect& point ) const;
00070
00071 //! Assumes planar faces
00072 double volume() const;
00073
00074 // Check that data structure is consistent and represents
00075 // a closed polyhedron
00076 bool is_valid() const;
00077
00078 /** For debugging, does nothing unless debug feature is enabled */
00079 static void reset_debug_ids();
00080 };
00081
00082 } // namespace moab
00083
00084 #endif