RTK  1.4.0
Reconstruction Toolkit
rtkConvexShape.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright RTK Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef rtkConvexShape_h
20 #define rtkConvexShape_h
21 
22 #include <itkMatrix.h>
23 #include <itkPoint.h>
24 #include <itkDataObject.h>
25 #include <itkObjectFactory.h>
26 
27 #include "rtkWin32Header.h"
28 #include "rtkMacro.h"
29 
30 namespace rtk
31 {
47 {
48 public:
50  typedef ConvexShape Self;
54 
56  itkStaticConstMacro(Dimension, unsigned int, 3);
57  typedef double ScalarType;
61 
63  itkNewMacro ( Self );
64 
66  itkTypeMacro(ConvexShape, itk::DataObject);
67 
69  virtual bool IsInside(const PointType & point) const;
70 
74  virtual bool IsIntersectedByRay(const PointType & rayOrigin,
75  const VectorType & rayDirection,
76  double & nearDist,
77  double & farDist) const;
78 
80  virtual void Rescale(const VectorType &r);
81 
83  virtual void Translate(const VectorType &t);
84 
86  virtual void Rotate(const RotationMatrixType &r);
87 
90  void AddClipPlane(const VectorType & dir, const ScalarType & pos);
91  void SetClipPlanes(const std::vector<VectorType> & dir, const std::vector<ScalarType> & pos);
93 
95  itkSetMacro (Density, ScalarType);
96  itkGetConstMacro (Density, ScalarType);
97  itkGetMacro (Density, ScalarType);
99 
101  itkGetConstReferenceMacro(PlaneDirections, std::vector<VectorType>);
102  itkGetConstReferenceMacro(PlanePositions, std::vector<ScalarType>);
104 
105 protected:
106  ConvexShape();
107  bool ApplyClipPlanes(const PointType & rayOrigin,
108  const VectorType & rayDirection,
109  ScalarType & nearDist,
110  ScalarType & farDist) const;
111  bool ApplyClipPlanes(const PointType & point) const;
112  virtual itk::LightObject::Pointer InternalClone() const ITK_OVERRIDE;
113 
114 private:
115  ConvexShape(const Self&); //purposely not implemented
116  void operator=(const Self&); //purposely not implemented
117 
118  ScalarType m_Density;
119  std::vector<VectorType> m_PlaneDirections;
120  std::vector<ScalarType> m_PlanePositions;
121 };
122 
123 }
124 #endif
itk::Vector< ScalarType, Dimension > VectorType
ConvexShape Self
itk::Vector< ScalarType, Dimension > PointType
STL namespace.
itk::Matrix< ScalarType, Dimension, Dimension > RotationMatrixType
itk::DataObject Superclass
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
#define RTK_EXPORT
Base class for a 3D convex shape.
#define itkSetMacro(name, type)