| 1 | #include "Body_ccapi.h" |
|---|
| 2 | |
|---|
| 3 | #include "Body.hpp" |
|---|
| 4 | #include "CubitBox.hpp" |
|---|
| 5 | |
|---|
| 6 | /* topology */ |
|---|
| 7 | |
|---|
| 8 | EntityType Body_get_sense_entity_type(void *) |
|---|
| 9 | { return CoVolume_TYPE; } |
|---|
| 10 | /*R EntityType |
|---|
| 11 | *R- The type of the specific sense entity. |
|---|
| 12 | *- This function returns the type of the specific sense entity. |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | EntityType Body_get_basic_topology_entity_type(void *) |
|---|
| 16 | { return InvalidEntity_TYPE; } |
|---|
| 17 | /*R EntityType |
|---|
| 18 | *R- The type of the corresponding BasicTopologyEntity type. |
|---|
| 19 | *- This function returns the type of the corresponding |
|---|
| 20 | *- BasicTopologyEntity . |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | EntityType Body_get_child_basic_topology_entity_type(void *) |
|---|
| 24 | { return RefVolume_TYPE; } |
|---|
| 25 | /*R EntityType |
|---|
| 26 | *R- A type value. |
|---|
| 27 | *- This function returns the type of the child RefEntity of |
|---|
| 28 | *- Body, which is the type value of the RefVolume class. |
|---|
| 29 | */ |
|---|
| 30 | |
|---|
| 31 | EntityType Body_get_child_ref_entity_type(void *) |
|---|
| 32 | { return RefVolume_TYPE; } |
|---|
| 33 | /*R EntityType |
|---|
| 34 | *R- A type value. |
|---|
| 35 | *- This function returns the type of the child RefEntity of |
|---|
| 36 | *- Body, which is the type value of the RefVolume class. |
|---|
| 37 | */ |
|---|
| 38 | |
|---|
| 39 | EntityType Body_get_parent_ref_entity_type(void *) |
|---|
| 40 | { return InvalidEntity_TYPE; } |
|---|
| 41 | /*R EntityType |
|---|
| 42 | *R- A type value. |
|---|
| 43 | *- This function returns the type of the child RefEntity of |
|---|
| 44 | *- Body, which is the type value of the RefVolume class. |
|---|
| 45 | */ |
|---|
| 46 | |
|---|
| 47 | /* geometry */ |
|---|
| 48 | |
|---|
| 49 | CubitBoxStruct Body_bounding_box(void *this_body) |
|---|
| 50 | { |
|---|
| 51 | Body *temp_body = (Body *) this_body; |
|---|
| 52 | return temp_body->bounding_box(); |
|---|
| 53 | } |
|---|
| 54 | /*- Returns the bounding box of this body |
|---|
| 55 | */ |
|---|
| 56 | |
|---|
| 57 | CubitVectorStruct Body_center_point(void *this_body) |
|---|
| 58 | { |
|---|
| 59 | Body *temp_body = (Body *) this_body; |
|---|
| 60 | return temp_body->center_point(); |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | /*- Return a CubitVector set to the centroid of this body |
|---|
| 64 | */ |
|---|
| 65 | |
|---|
| 66 | double Body_measure(void *this_body) |
|---|
| 67 | { |
|---|
| 68 | Body *temp_body = (Body *) this_body; |
|---|
| 69 | return temp_body->measure(); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | /*- Heading: geometry modification functions */ |
|---|
| 73 | |
|---|
| 74 | /* Body* */ void * Body_copy(void *this_body) |
|---|
| 75 | { |
|---|
| 76 | Body *temp_body = (Body *) this_body; |
|---|
| 77 | return temp_body->copy(); |
|---|
| 78 | } |
|---|
| 79 | /*- Copy this Body to another body |
|---|
| 80 | */ |
|---|
| 81 | |
|---|
| 82 | CubitStatus Body_move(void *this_body, double dx, double dy, double dz, |
|---|
| 83 | CubitBoolean update_now) |
|---|
| 84 | { |
|---|
| 85 | Body *temp_body = (Body *) this_body; |
|---|
| 86 | return temp_body->move(dx, dy, dz, update_now); |
|---|
| 87 | } |
|---|
| 88 | /*- Move this Body by dx, dy and dz |
|---|
| 89 | */ |
|---|
| 90 | |
|---|
| 91 | CubitStatus Body_rotate(void *this_body, double x, double y, double z, double angle, |
|---|
| 92 | CubitBoolean update_now) |
|---|
| 93 | { |
|---|
| 94 | Body *temp_body = (Body *) this_body; |
|---|
| 95 | return temp_body->rotate(x, y, z, angle, update_now); |
|---|
| 96 | } |
|---|
| 97 | /*- Rotates this Body about a vector defined by x, y and z |
|---|
| 98 | */ |
|---|
| 99 | |
|---|
| 100 | CubitStatus Body_scale(void *this_body, double scaling_factor, |
|---|
| 101 | CubitBoolean update_now) |
|---|
| 102 | { |
|---|
| 103 | Body *temp_body = (Body *) this_body; |
|---|
| 104 | return temp_body->scale(scaling_factor, update_now); |
|---|
| 105 | } |
|---|
| 106 | /*- Scales this Body by the factor, scaling_factor |
|---|
| 107 | */ |
|---|
| 108 | |
|---|
| 109 | CubitStatus Body_restore(void *this_body, CubitBoolean update_now) |
|---|
| 110 | { |
|---|
| 111 | Body *temp_body = (Body *) this_body; |
|---|
| 112 | return temp_body->restore(update_now); |
|---|
| 113 | } |
|---|
| 114 | /*- Restores this Body by replacing the transformation matrix |
|---|
| 115 | *- associated with it with a unit matrix |
|---|
| 116 | */ |
|---|
| 117 | |
|---|
| 118 | CubitStatus Body_reverse(void *this_body, CubitBoolean update_now) |
|---|
| 119 | { |
|---|
| 120 | Body *temp_body = (Body *) this_body; |
|---|
| 121 | return temp_body->reverse(update_now); |
|---|
| 122 | } |
|---|
| 123 | /*- reverses the orientation of the faces on this body |
|---|
| 124 | */ |
|---|
| 125 | |
|---|
| 126 | CubitStatus Body_transform_position(void *this_body, /* CubitVector const& */ CubitVectorStruct position_vector, |
|---|
| 127 | /* CubitVector & */ CubitVectorStruct *transformed_vector) |
|---|
| 128 | { |
|---|
| 129 | Body *temp_body = (Body *) this_body; |
|---|
| 130 | |
|---|
| 131 | CubitVector temp_position_vector(position_vector); |
|---|
| 132 | CubitVector temp_transformed_vector; |
|---|
| 133 | |
|---|
| 134 | CubitStatus status = temp_body->transform_position(temp_position_vector, temp_transformed_vector); |
|---|
| 135 | |
|---|
| 136 | *transformed_vector = temp_transformed_vector; |
|---|
| 137 | |
|---|
| 138 | return status; |
|---|
| 139 | } |
|---|
| 140 | /*R CubitStatus |
|---|
| 141 | *R- CUBIT_SUCCESS/FAILURE |
|---|
| 142 | *I position_vector |
|---|
| 143 | *I- The input vector that needs to be transformed. |
|---|
| 144 | *O transformed_vector |
|---|
| 145 | *O- The transformed CubitVector -- sent in by reference. |
|---|
| 146 | *- This function will transform the input position_vector using |
|---|
| 147 | *- the transformation matrix associated with the underlying geometry |
|---|
| 148 | *- of this Body. If there is none, then CUBIT_FAILURE is returned |
|---|
| 149 | *- and transformed_vector is left untouched. |
|---|
| 150 | *- Note: The input vector *must* have 3 components. |
|---|
| 151 | */ |
|---|
| 152 | |
|---|
| 153 | int Body_validate(void *this_body) |
|---|
| 154 | { |
|---|
| 155 | Body *temp_body = (Body *) this_body; |
|---|
| 156 | return temp_body->validate(); |
|---|
| 157 | } |
|---|
| 158 | /*- do a measure and api entity check. |
|---|
| 159 | */ |
|---|
| 160 | |
|---|
| 161 | /* CubitString */ const char *Body_measure_label(void *this_body) |
|---|
| 162 | { |
|---|
| 163 | Body *temp_body = (Body *) this_body; |
|---|
| 164 | return temp_body->measure_label().c_str(); |
|---|
| 165 | } |
|---|
| 166 | /*- Functions related to "measuring" the Body |
|---|
| 167 | */ |
|---|
| 168 | |
|---|
| 169 | EntityType Body_entity_type(void *) |
|---|
| 170 | { return Body_TYPE ; } |
|---|
| 171 | |
|---|
| 172 | void* Body_get_address(void *this_body, EntityType inputEntityType) |
|---|
| 173 | { |
|---|
| 174 | Body *temp_body = (Body *) this_body; |
|---|
| 175 | return temp_body->get_address(inputEntityType); |
|---|
| 176 | } |
|---|
| 177 | /*R void* |
|---|
| 178 | *R- Returned void pointer |
|---|
| 179 | *I inputEntityType |
|---|
| 180 | *I- The input type to get the address of. |
|---|
| 181 | *- This function returns a void pointer that points to the |
|---|
| 182 | *- "appropriate" portion of this object. The appropriate |
|---|
| 183 | *- portion is determined by the input EntityType variable. |
|---|
| 184 | *- Returns NULL if the input type and the type of "this" |
|---|
| 185 | *- are not related by inheritance. |
|---|
| 186 | *- Note: The RTTI capabilities encoded in these functions |
|---|
| 187 | *- are designed to work with any form of multiple |
|---|
| 188 | *- inheritance, as well. Multiple inheritance is what |
|---|
| 189 | *- necessitates having this function defined in every |
|---|
| 190 | *- class in the hierarchy. |
|---|
| 191 | *- Note: This function can also be used to merely check if |
|---|
| 192 | *- an object of one type is related to another type |
|---|
| 193 | *- through inheritance. If a non-NULL pointer is |
|---|
| 194 | *- returned, then this is true. |
|---|
| 195 | */ |
|---|
| 196 | |
|---|
| 197 | void Body_copiedFromId_1(void *this_body, int Id ) |
|---|
| 198 | { |
|---|
| 199 | Body *temp_body = (Body *) this_body; |
|---|
| 200 | temp_body->copiedFromId(Id); |
|---|
| 201 | } |
|---|
| 202 | |
|---|
| 203 | int Body_copiedFromId_2 (void *this_body) |
|---|
| 204 | { |
|---|
| 205 | Body *temp_body = (Body *) this_body; |
|---|
| 206 | return temp_body->copiedFromId(); |
|---|
| 207 | } |
|---|
| 208 | /*- Sets/Gets the id of the body that it was copied from */ |
|---|