STIR 6.4.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
27START_NAMESPACE_STIR
28
29template <class T>
30struct logical_and_not
31{
32 inline bool operator()(const T& x, const T& y) const { return x && !y; }
33};
34
35template <class T>
36struct logical_and
37{
38 inline bool operator()(const T& x, const T& y) const { return x || y; }
39};
40
47template <class operation = logical_and<bool>>
48class CombinedShape3D : public RegisteredParsingObject<CombinedShape3D, Shape3D, Shape3D>
49{
50public:
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
60private:
61 shared_ptr<Shape3D> object1_ptr;
62 shared_ptr<Shape3D> object2_ptr;
63};
64
65END_NAMESPACE_STIR
66
68
69#endif
Inline implementations of class stir::CombinedShape3D.
Declaration of class stir::RegisteredParsingObject.
Declaration of class stir::Shape3D.
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
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files.
Definition RegisteredParsingObject.h:78
The base class for all 3 dimensional shapes.
Definition Shape3D.h:66
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast into the stir names...