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  itkOverrideGetNameOfClassMacro(QuadricShape);
64 
66  bool
67  IsInside(const PointType & point) const override;
68 
70  bool
71  IsInsideQuadric(const PointType & point) const;
72 
76  bool
77  IsIntersectedByRay(const PointType & rayOrigin,
78  const VectorType & rayDirection,
79  double & nearDist,
80  double & farDist) const override;
81 
83  void
84  Rescale(const VectorType & r) override;
85 
87  void
88  Translate(const VectorType & t) override;
89 
91  void
92  Rotate(const RotationMatrixType & r) override;
93 
94  itkGetConstMacro(A, ScalarType);
96  itkGetConstMacro(B, ScalarType);
98  itkGetConstMacro(C, ScalarType);
100  itkGetConstMacro(D, ScalarType);
102  itkGetConstMacro(E, ScalarType);
104  itkGetConstMacro(F, ScalarType);
106  itkGetConstMacro(G, ScalarType);
108  itkGetConstMacro(H, ScalarType);
110  itkGetConstMacro(I, ScalarType);
112  itkGetConstMacro(J, ScalarType);
114 
115  void
116  SetEllipsoid(const PointType & center, const VectorType & axis, const ScalarType & yangle = 0);
117 
119  InternalClone() const override;
120 
121 private:
122  QuadricShape();
123 
124  ScalarType m_A{ 0. };
125  ScalarType m_B{ 0. };
126  ScalarType m_C{ 0. };
127  ScalarType m_D{ 0. };
128  ScalarType m_E{ 0. };
129  ScalarType m_F{ 0. };
130  ScalarType m_G{ 0. };
131  ScalarType m_H{ 0. };
132  ScalarType m_I{ 0. };
133  ScalarType m_J{ 0. };
134 };
135 
136 } // end namespace rtk
137 
138 #endif
#define itkSetMacro(name, type)
Defines a 3D quadric shape.
Base class for a 3D convex shape.