1 #ifndef VTESTBED_DB_SHIP_HULL_TRANSFORMATION_HH 2 #define VTESTBED_DB_SHIP_HULL_TRANSFORMATION_HH 8 #include <sqlitex/forward.hh> 10 #include <vtestbed/geometry/polyhedron.hh> 16 enum class Transformations {
22 Centre_of_bounding_box = 6,
41 using vertex_type =
typename polyhedron_type::vertex_type;
43 enum class Type {Integer, Real};
47 union {
int int_number; T real_number; };
49 Argument(): type(Type::Integer), int_number(0) {}
50 Argument(
int n): type(Type::Integer), int_number(n) {}
51 Argument(T n): type(Type::Real), real_number(n) {}
56 Transformations _transformation{};
66 _transformation{tr} {}
69 Ship_hull_transformation(Transformations tr,
int dim):
70 _transformation{tr}, _dimension{dim} {}
73 Ship_hull_transformation(
78 _transformation{tr}, _dimension{dim}, _argument{arg} {}
83 inline Transformations
84 transformation()
const {
85 return this->_transformation;
92 const Ship_hull_transformation<X>& rhs
99 Ship_hull_transformation<X>& rhs
106 operator<<(
std::ostream& out,
const Ship_hull_transformation<T>& rhs);
110 operator>>(
std::istream& in, Ship_hull_transformation<T>& rhs);
114 to_string(
const Ship_hull_transformation<T>& rhs);
122 typedef typename transform_array::iterator iterator;
123 typedef typename transform_array::const_iterator const_iterator;
132 transformations()
const {
133 return this->_transforms;
136 inline size_t index()
const {
return this->_index; }
140 if (index() == 0) {
return; };
146 if (index() == this->_transforms.size()) {
return; };
152 this->_transforms.clear();
156 inline const_iterator
158 return this->_transforms.begin();
161 inline const_iterator
163 return this->begin() + this->index();
173 auto& ts = this->_transforms;
174 ts.resize(this->_index);
175 this->_transforms.push_back(t);
201 #endif // vim:filetype=cpp