ITK  6.0.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
23namespace itk
24{
30template <typename TPoint>
31class ITK_TEMPLATE_EXPORT TriangleHelper
32{
33public:
35 using PointType = TPoint;
36 using CoordinateType = typename PointType::CoordinateType;
37#ifndef ITK_FUTURE_LEGACY_REMOVE
38 using CoordRepType ITK_FUTURE_DEPRECATED(
39 "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") = CoordinateType;
40#endif
43
44 static constexpr unsigned int PointDimension = PointType::PointDimension;
45
48 static bool
49 IsObtuse(const PointType & iA, const PointType & iB, const PointType & iC);
50
52 static VectorType
53 ComputeNormal(const PointType & iA, const PointType & iB, const PointType & iC);
54
56 static CoordinateType
57 Cotangent(const PointType & iA, const PointType & iB, const PointType & iC);
58
60 static PointType
62 const PointType & iP1,
63 const CoordinateType & iA2,
64 const PointType & iP2,
65 const CoordinateType & iA3,
66 const PointType & iP3);
67
69 static CoordinateType
70 ComputeAngle(const PointType & iP1, const PointType & iP2, const PointType & iP3);
71
73 static PointType
74 ComputeGravityCenter(const PointType & iP1, const PointType & iP2, const PointType & iP3);
75
77 static PointType
78 ComputeCircumCenter(const PointType & iP1, const PointType & iP2, const PointType & iP3);
79
81 static PointType
82 ComputeConstrainedCircumCenter(const PointType & iP1, const PointType & iP2, const PointType & iP3);
83
85 static CoordinateType
86 ComputeArea(const PointType & iP1, const PointType & iP2, const PointType & iP3);
87
88 static CoordinateType
89 ComputeMixedArea(const PointType & iP1, const PointType & iP2, const PointType & iP3);
90};
91} // namespace itk
92
93#include "itkTriangleHelper.hxx"
94#endif
A convenience class for computation of various triangle elements in 2D or 3D.
static CoordinateType Cotangent(const PointType &iA, const PointType &iB, const PointType &iC)
Compute cotangent(iA,iB,iC)
typename PointType::CoordinateType CoordinateType
static bool IsObtuse(const PointType &iA, const PointType &iB, const PointType &iC)
return true if (iA,iB,iC) forms an Obtuse angle (above 90 degrees)
static PointType ComputeBarycenter(const CoordinateType &iA1, const PointType &iP1, const CoordinateType &iA2, const PointType &iP2, const CoordinateType &iA3, const PointType &iP3)
Compute barycenter, with given weights.
static PointType ComputeGravityCenter(const PointType &iP1, const PointType &iP2, const PointType &iP3)
Compute center of mass.
static CoordinateType ComputeArea(const PointType &iP1, const PointType &iP2, const PointType &iP3)
Compute Area.
static PointType ComputeCircumCenter(const PointType &iP1, const PointType &iP2, const PointType &iP3)
Compute circum center.
static VectorType ComputeNormal(const PointType &iA, const PointType &iB, const PointType &iC)
Compute Normal vector to the triangle formed by (iA,iB,iC)
static PointType ComputeConstrainedCircumCenter(const PointType &iP1, const PointType &iP2, const PointType &iP3)
Compute circum center constrained to be inside the triangle.
typename PointType::VectorType VectorType
static CoordinateType ComputeMixedArea(const PointType &iP1, const PointType &iP2, const PointType &iP3)
static CoordinateType ComputeAngle(const PointType &iP1, const PointType &iP2, const PointType &iP3)
Compute angles (iA,iB,iC)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....