Shapeworks Studio  2.1
Shape analysis software suite
itkPSMParticleSystem.cxx
1 /*=========================================================================
2  *
3  * Copyright Insight Software 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  * http://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 #include "itkPSMParticleSystem.h"
19 
20 namespace itk {
21 
23 template<>
26 ::TransformPoint(const PointType &p, const TransformType &T) const
27 {
28  PointType ans;
29 
30  ans[0] = T[0][0] * p[0] + T[0][1] * p[1] + T[0][2] * p[2] + T[0][3];
31  ans[1] = T[1][0] * p[0] + T[1][1] * p[1] + T[1][2] * p[2] + T[1][3];
32  ans[2] = T[2][0] * p[0] + T[2][1] * p[1] + T[2][2] * p[2] + T[2][3];
33 
34  return ans;
35 }
36 
38 template<>
41 ::TransformPoint(const PointType &p, const TransformType &T) const
42 {
43  PointType ans;
44 
45  ans[0] = T[0][0] * p[0] + T[0][1] * p[1] + T[0][2];
46  ans[1] = T[1][0] * p[0] + T[1][1] * p[1] + T[1][2];
47 
48  return ans;
49 }
50 
51 
53 template<>
54 PSMParticleSystem<3>::VectorType
56 ::TransformVector(const VectorType &p, const TransformType &T) const
57 {
58  VectorType ans;
59 
60  ans[0] = T[0][0] * p[0] + T[0][1] * p[1] + T[0][2] * p[2];
61  ans[1] = T[1][0] * p[0] + T[1][1] * p[1] + T[1][2] * p[2];
62  ans[2] = T[2][0] * p[0] + T[2][1] * p[1] + T[2][2] * p[2];
63 
64  return ans;
65 }
66 
68 template<>
69 PSMParticleSystem<2>::VectorType
71 ::TransformVector(const VectorType &p, const TransformType &T) const
72 {
73  VectorType ans;
74 
75  ans[0] = T[0][0] * p[0] + T[0][1] * p[1];
76  ans[1] = T[1][0] * p[0] + T[1][1] * p[1];
77 
78  return ans;
79 }
80 
81 } // end namespace
Point< double, VDimension > PointType
VectorType TransformVector(const VectorType &, const TransformType &) const
PointType TransformPoint(const PointType &, const TransformType &) const
Definition: Shape.h:14
vnl_matrix_fixed< double, VDimension+1, VDimension+1 > TransformType