| 1 | /*------------------------------------------------------------------------- |
|---|
| 2 | * Filename : Body.hpp |
|---|
| 3 | * |
|---|
| 4 | * Purpose : This class represents the topological entity, Body, |
|---|
| 5 | * which is the highest level abstraction for a complete |
|---|
| 6 | * geometric model. |
|---|
| 7 | * |
|---|
| 8 | * Special Notes : Body is a GroupingEntity in the TopologyEntity hierarchy. |
|---|
| 9 | * It is also a RefEntity and get a lot of its functionality |
|---|
| 10 | * and data from the RefEntity base class for meshing |
|---|
| 11 | * purposes. |
|---|
| 12 | * |
|---|
| 13 | * The user is provided a handle to Bodies. |
|---|
| 14 | * |
|---|
| 15 | * Creator : |
|---|
| 16 | * |
|---|
| 17 | * Creation Date : |
|---|
| 18 | * |
|---|
| 19 | * Owner : |
|---|
| 20 | *------------------------------------------------------------------------- |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | #ifndef BODY_HPP |
|---|
| 24 | #define BODY_HPP |
|---|
| 25 | |
|---|
| 26 | #include "GroupingEntity.hpp" |
|---|
| 27 | #include "RefEntity.hpp" |
|---|
| 28 | #include "CoVolume.hpp" |
|---|
| 29 | #include "RefVolume.hpp" |
|---|
| 30 | |
|---|
| 31 | class CubitTransformMatrix; |
|---|
| 32 | |
|---|
| 33 | class CUBIT_GEOM_EXPORT Body : public GroupingEntity, |
|---|
| 34 | public RefEntity |
|---|
| 35 | { |
|---|
| 36 | public : |
|---|
| 37 | |
|---|
| 38 | /*- the factory is allowed to call the (private) constructors */ |
|---|
| 39 | friend class RefEntityFactory; |
|---|
| 40 | |
|---|
| 41 | /* constructors/destructors */ |
|---|
| 42 | |
|---|
| 43 | virtual ~Body() ; |
|---|
| 44 | /*- The destructor. */ |
|---|
| 45 | |
|---|
| 46 | /* topology */ |
|---|
| 47 | |
|---|
| 48 | DagType dag_type() const { return DagType::body_type(); } |
|---|
| 49 | const type_info& entity_type_info() const { return typeid(Body); } |
|---|
| 50 | |
|---|
| 51 | static const char* get_class_name() |
|---|
| 52 | { |
|---|
| 53 | return "Body"; |
|---|
| 54 | } |
|---|
| 55 | virtual const char* class_name() const |
|---|
| 56 | { |
|---|
| 57 | return get_class_name(); |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | BodySM* get_body_sm_ptr() const; |
|---|
| 61 | |
|---|
| 62 | virtual CubitBox bounding_box(); |
|---|
| 63 | /*- Returns the bounding box of this body |
|---|
| 64 | */ |
|---|
| 65 | |
|---|
| 66 | virtual CubitVector center_point(); |
|---|
| 67 | /*- Return a CubitVector set to the centroid of this body |
|---|
| 68 | */ |
|---|
| 69 | |
|---|
| 70 | CubitBoolean get_mass_props(CubitVector& cofg); |
|---|
| 71 | /* Get certain mass props, cofg is center of gravity */ |
|---|
| 72 | |
|---|
| 73 | CubitPointContainment point_containment( CubitVector &point ); |
|---|
| 74 | //- Determines whether a point is inside, outside, or on boundary |
|---|
| 75 | //- of a volume. |
|---|
| 76 | |
|---|
| 77 | virtual double measure(); |
|---|
| 78 | CubitBoolean is_sheet_body(); |
|---|
| 79 | |
|---|
| 80 | #ifdef BOYD14 |
|---|
| 81 | CubitStatus get_transforms(CubitTransformMatrix &tfm); |
|---|
| 82 | /*- returns the body transformation matrix |
|---|
| 83 | */ |
|---|
| 84 | #endif |
|---|
| 85 | |
|---|
| 86 | #ifdef BOYD14 |
|---|
| 87 | CubitStatus transform_position(CubitVector const& position_vector, |
|---|
| 88 | CubitVector & transformed_vector); |
|---|
| 89 | /*R CubitStatus |
|---|
| 90 | *R- CUBIT_SUCCESS/FAILURE |
|---|
| 91 | *I position_vector |
|---|
| 92 | *I- The input vector that needs to be transformed. |
|---|
| 93 | *O transformed_vector |
|---|
| 94 | *O- The transformed CubitVector -- sent in by reference. |
|---|
| 95 | *- This function will transform the input position_vector using |
|---|
| 96 | *- the transformation matrix associated with the underlying geometry |
|---|
| 97 | *- of this Body. If there is none, then CUBIT_FAILURE is returned |
|---|
| 98 | *- and transformed_vector is left untouched. |
|---|
| 99 | *- Note: The input vector *must* have 3 components. |
|---|
| 100 | */ |
|---|
| 101 | #endif |
|---|
| 102 | |
|---|
| 103 | virtual int validate(); |
|---|
| 104 | /*- do a measure and api entity check. |
|---|
| 105 | */ |
|---|
| 106 | |
|---|
| 107 | virtual CubitString measure_label(); |
|---|
| 108 | /*- Functions related to "measuring" the Body |
|---|
| 109 | */ |
|---|
| 110 | |
|---|
| 111 | void copiedFromId( int Id ); |
|---|
| 112 | int copiedFromId (); |
|---|
| 113 | /*- Sets/Gets the id of the body that it was copied from */ |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | virtual void color(int value); |
|---|
| 117 | virtual int color() const; |
|---|
| 118 | |
|---|
| 119 | protected: |
|---|
| 120 | |
|---|
| 121 | Body() ; |
|---|
| 122 | /*- The default constructor. |
|---|
| 123 | */ |
|---|
| 124 | |
|---|
| 125 | Body(BodySM* OSMEPtr) ; |
|---|
| 126 | /*- The constructor with a pointer to an other solid model entity. |
|---|
| 127 | */ |
|---|
| 128 | |
|---|
| 129 | private: |
|---|
| 130 | |
|---|
| 131 | #ifdef BOYD14 |
|---|
| 132 | void notify_model(CubitEventType eventType); |
|---|
| 133 | /*R void |
|---|
| 134 | *I eventType |
|---|
| 135 | *I- The type of event that occurred |
|---|
| 136 | *- This function notifies the owning Model of the event that |
|---|
| 137 | *- occured to this Body (see the EventType enum for the list of |
|---|
| 138 | *- recognized events). |
|---|
| 139 | */ |
|---|
| 140 | #endif |
|---|
| 141 | |
|---|
| 142 | int copied_from_body_id; |
|---|
| 143 | |
|---|
| 144 | Body( const Body& ); |
|---|
| 145 | void operator=( const Body& ); |
|---|
| 146 | |
|---|
| 147 | } ; |
|---|
| 148 | |
|---|
| 149 | #endif |
|---|