22template <
class operation>
23CombinedShape3D<operation>::CombinedShape3D(shared_ptr<Shape3D> object1_v, shared_ptr<Shape3D> object2_v)
24 : object1_ptr(object1_v),
25 object2_ptr(object2_v)
28template <
class operation>
32 return operation()(object1_ptr->is_inside_shape(index), object2_ptr->is_inside_shape(index));
35template <
class operation>
41 Shape3D* tmp =
static_cast<Shape3D *
>(
new CombinedShape3D<operation>(*
this));
42 cerr <<
"Cloning " <<
this <<
43 ", new " << tmp << endl;
46 return static_cast<Shape3D*
>(
new CombinedShape3D<operation>(*
this));
50template <
class operation>
55 shared_ptr<Shape3D> new_object1_ptr = object1_ptr->clone();
56 shared_ptr<Shape3D> new_object2_ptr = object2_ptr->clone();
57 object1_ptr = new_object1_ptr;
58 object2_ptr = new_object2_ptr;
59 object1_ptr->translate(direction);
60 object2_ptr->translate(direction);
63template <
class operation>
69 cerr <<
"scale: " << object1_ptr.ptr->data
70 <<
", " << object2_ptr.ptr->data << endl;
72 shared_ptr<Shape3D> new_object1_ptr = object1_ptr->clone();
73 shared_ptr<Shape3D> new_object2_ptr = object2_ptr->clone();
74 object1_ptr = new_object1_ptr;
75 object2_ptr = new_object2_ptr;
76 object1_ptr->scale(scale3D);
77 object2_ptr->scale(scale3D);
a templated class for 3-dimensional coordinates.
Definition CartesianCoordinate3D.h:53
void translate(const CartesianCoordinate3D< float > &direction)
translate the whole shape by shifting its origin
Definition CombinedShape3D.inl:52
bool is_inside_shape(const CartesianCoordinate3D< float > &coord) const
determine if a point is inside the shape or not (up to floating point errors)
Definition CombinedShape3D.inl:30
Shape3D * clone() const
Allocate a new Shape3D object which is a copy of the current one.
Definition CombinedShape3D.inl:37
void scale(const CartesianCoordinate3D< float > &scale3D)
scale the whole shape
Definition CombinedShape3D.inl:65
The base class for all 3 dimensional shapes.
Definition Shape3D.h:66