STIR  6.2.0
CombinedShape3D.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2000- 2007, Hammersmith Imanet Ltd
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0
8 
9  See STIR/LICENSE.txt for details
10 */
20 #ifndef __stir_Shape_CombinedShape3D_h__
21 #define __stir_Shape_CombinedShape3D_h__
22 
24 #include "stir/Shape/Shape3D.h"
25 #include "stir/shared_ptr.h"
26 
27 START_NAMESPACE_STIR
28 
29 template <class T>
30 struct logical_and_not
31 {
32  inline bool operator()(const T& x, const T& y) const { return x && !y; }
33 };
34 
35 template <class T>
36 struct logical_and
37 {
38  inline bool operator()(const T& x, const T& y) const { return x || y; }
39 };
40 
47 template <class operation = logical_and<bool>>
48 class CombinedShape3D : public RegisteredParsingObject<CombinedShape3D, Shape3D, Shape3D>
49 {
50 public:
51  // Name which will be used when parsing a Shape3D object
52  // static const char * const registered_name;
53 
54  inline CombinedShape3D(shared_ptr<Shape3D> object1_v, shared_ptr<Shape3D> object2_v);
55  inline bool is_inside_shape(const CartesianCoordinate3D<float>& coord) const;
56  inline void translate(const CartesianCoordinate3D<float>& direction);
57  inline void scale(const CartesianCoordinate3D<float>& scale3D);
58  inline Shape3D* clone() const;
59 
60 private:
61  shared_ptr<Shape3D> object1_ptr;
62  shared_ptr<Shape3D> object2_ptr;
63 };
64 
65 END_NAMESPACE_STIR
66 
68 
69 #endif
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
The base class for all 3 dimensional shapes.
Definition: Shape3D.h:65
Declaration of class stir::Shape3D.
Inline implementations of class stir::CombinedShape3D.
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files...
Definition: RegisteredParsingObject.h:77
A class that allows combining several shapes using logical operations.
Definition: CombinedShape3D.h:48
Declaration of class stir::RegisteredParsingObject.