RTK  2.6.0
Reconstruction Toolkit
rtkQuadricShape.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  * https://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 rtkQuadricShape_h
20 #define rtkQuadricShape_h
21 
22 #include "RTKExport.h"
23 #include <itkPoint.h>
24 #include <rtkMacro.h>
25 
26 #include "rtkConvexShape.h"
27 
28 namespace rtk
29 {
30 
45 class RTK_EXPORT QuadricShape : public ConvexShape
46 {
47 public:
49  using Self = QuadricShape;
53 
56  using PointType = Superclass::PointType;
57  using VectorType = Superclass::VectorType;
58 
60  itkNewMacro(Self);
61 
63 #ifdef itkOverrideGetNameOfClassMacro
64  itkOverrideGetNameOfClassMacro(QuadricShape);
65 #else
66  itkTypeMacro(QuadricShape, ConvexShape);
67 #endif
68 
69 
71  bool
72  IsInside(const PointType & point) const override;
73 
75  bool
76  IsInsideQuadric(const PointType & point) const;
77 
81  bool
82  IsIntersectedByRay(const PointType & rayOrigin,
83  const VectorType & rayDirection,
84  double & nearDist,
85  double & farDist) const override;
86 
88  void
89  Rescale(const VectorType & r) override;
90 
92  void
93  Translate(const VectorType & t) override;
94 
96  void
97  Rotate(const RotationMatrixType & r) override;
98 
99  itkGetConstMacro(A, ScalarType);
101  itkGetConstMacro(B, ScalarType);
103  itkGetConstMacro(C, ScalarType);
105  itkGetConstMacro(D, ScalarType);
107  itkGetConstMacro(E, ScalarType);
109  itkGetConstMacro(F, ScalarType);
111  itkGetConstMacro(G, ScalarType);
113  itkGetConstMacro(H, ScalarType);
115  itkGetConstMacro(I, ScalarType);
117  itkGetConstMacro(J, ScalarType);
119 
120  void
121  SetEllipsoid(const PointType & center, const VectorType & axis, const ScalarType & yangle = 0);
122 
124  InternalClone() const override;
125 
126 private:
127  QuadricShape();
128 
129  ScalarType m_A{ 0. };
130  ScalarType m_B{ 0. };
131  ScalarType m_C{ 0. };
132  ScalarType m_D{ 0. };
133  ScalarType m_E{ 0. };
134  ScalarType m_F{ 0. };
135  ScalarType m_G{ 0. };
136  ScalarType m_H{ 0. };
137  ScalarType m_I{ 0. };
138  ScalarType m_J{ 0. };
139 };
140 
141 } // end namespace rtk
142 
143 #endif
#define itkSetMacro(name, type)
Defines a 3D quadric shape.
Base class for a 3D convex shape.