ITK  5.4.0
Insight Toolkit
itkTriangleHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 #ifndef itkTriangleHelper_h
19 #define itkTriangleHelper_h
20 
21 #include "itkCrossHelper.h"
22 
23 namespace itk
24 {
30 template <typename TPoint>
31 class ITK_TEMPLATE_EXPORT TriangleHelper
32 {
33 public:
35  using PointType = TPoint;
36  using CoordRepType = typename PointType::CoordRepType;
39 
40  static constexpr unsigned int PointDimension = PointType::PointDimension;
41 
44  static bool
45  IsObtuse(const PointType & iA, const PointType & iB, const PointType & iC);
46 
48  static VectorType
49  ComputeNormal(const PointType & iA, const PointType & iB, const PointType & iC);
50 
52  static CoordRepType
53  Cotangent(const PointType & iA, const PointType & iB, const PointType & iC);
54 
56  static PointType
57  ComputeBarycenter(const CoordRepType & iA1,
58  const PointType & iP1,
59  const CoordRepType & iA2,
60  const PointType & iP2,
61  const CoordRepType & iA3,
62  const PointType & iP3);
63 
65  static CoordRepType
66  ComputeAngle(const PointType & iP1, const PointType & iP2, const PointType & iP3);
67 
69  static PointType
70  ComputeGravityCenter(const PointType & iP1, const PointType & iP2, const PointType & iP3);
71 
73  static PointType
74  ComputeCircumCenter(const PointType & iP1, const PointType & iP2, const PointType & iP3);
75 
77  static PointType
78  ComputeConstrainedCircumCenter(const PointType & iP1, const PointType & iP2, const PointType & iP3);
79 
81  static CoordRepType
82  ComputeArea(const PointType & iP1, const PointType & iP2, const PointType & iP3);
83 
84  static CoordRepType
85  ComputeMixedArea(const PointType & iP1, const PointType & iP2, const PointType & iP3);
86 };
87 } // namespace itk
88 
89 #include "itkTriangleHelper.hxx"
90 #endif
itkCrossHelper.h
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::TriangleHelper
A convenience class for computation of various triangle elements in 2D or 3D.
Definition: itkTriangleHelper.h:31
itk::TriangleHelper::CoordRepType
typename PointType::CoordRepType CoordRepType
Definition: itkTriangleHelper.h:36
itk::TriangleHelper::PointType
TPoint PointType
Definition: itkTriangleHelper.h:35
itk::CrossHelper
Definition: itkCrossHelper.h:36
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::TriangleHelper::VectorType
typename PointType::VectorType VectorType
Definition: itkTriangleHelper.h:37