ITK
6.0.0
Insight Toolkit
ITK
Modules
Core
Common
include
itkCrossHelper.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 itkCrossHelper_h
19
#define itkCrossHelper_h
20
21
#include "
itkNumericTraits.h
"
22
23
namespace
itk
24
{
35
template
<
typename
TVector>
36
class
CrossHelper
37
{
38
public
:
39
using
VectorType
= TVector;
40
using
ValueType
=
typename
VectorType::ValueType;
41
42
static
constexpr
unsigned
int
Dimension
=
VectorType::Dimension
;
43
49
VectorType
50
operator()
(
const
VectorType
& iU,
const
VectorType
& iV)
const
51
{
52
VectorType
oCross;
53
54
if
constexpr (
Dimension
> 2)
55
{
56
oCross[0] = iU[1] * iV[2] - iV[1] * iU[2];
57
oCross[1] = iV[0] * iU[2] - iU[0] * iV[2];
58
oCross[2] = iU[0] * iV[1] - iV[0] * iU[1];
59
60
if
constexpr (
Dimension
> 3)
61
{
62
for
(
unsigned
int
dim = 3; dim <
Dimension
; ++dim)
63
{
64
oCross[dim] = 0.0;
65
}
66
}
67
}
68
else
69
{
70
oCross.Fill(0.);
71
}
72
73
return
oCross;
74
}
75
};
76
}
// namespace itk
77
78
#endif
itk::CrossHelper::Dimension
static constexpr unsigned int Dimension
Definition:
itkCrossHelper.h:42
itk::CrossHelper
Definition:
itkCrossHelper.h:36
itk::CrossHelper::ValueType
typename VectorType::ValueType ValueType
Definition:
itkCrossHelper.h:40
itk::CrossHelper::operator()
VectorType operator()(const VectorType &iU, const VectorType &iV) const
Definition:
itkCrossHelper.h:50
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition:
itkAnatomicalOrientation.h:29
itk::CrossHelper::VectorType
TVector VectorType
Definition:
itkCrossHelper.h:39
itkNumericTraits.h
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition:
itkGTestTypedefsAndConstructors.h:44
Generated on
unknown
for ITK by
1.8.16