@@ -25,11 +25,6 @@ transformation_matrix(trans::AbstractAffineTransformation) = error("AbstractAffi
25
25
translation_vector (trans:: AbstractAffineTransformation ) = error (" AbstractAffineTransformation $(typeof (trans)) must implement translation_vector()" )
26
26
translation_vector_reverse (:: AbstractAffineTransformation ) = transformation_matrix (trans) \ translation_vector (trans)
27
27
28
- # Default implementations
29
- @compat function (trans:: AbstractAffineTransformation )(x)
30
- transformation_matrix (trans) * x + translation_vector (trans)
31
- end
32
-
33
28
# Could try do similar for transform_deriv_params()?
34
29
35
30
transform_deriv (trans:: AbstractAffineTransformation , x) = transformation_matrix (trans)
@@ -77,11 +72,6 @@ function translation_vector_reverse(trans::AbstractLinearTransformation)
77
72
return zeros (T, s)
78
73
end
79
74
80
- # Default implementations
81
- @compat function (trans:: AbstractLinearTransformation )(x)
82
- transformation_matrix (trans) * x
83
- end
84
-
85
75
# transform_deriv() identical to that provided by AbstractAffineTransformation
86
76
87
77
function Base. isapprox (t1:: AbstractLinearTransformation , t2:: AbstractLinearTransformation ; kwargs... )
@@ -121,10 +111,6 @@ abstract AbstractTranslation <: AbstractAffineTransformation
121
111
122
112
@inline transformation_matrix (:: AbstractTranslation ) = I
123
113
124
- @compat function (trans:: AbstractTranslation )(x)
125
- x + translation_vector (trans)
126
- end
127
-
128
114
129
115
# ##################
130
116
# ## Translation ###
@@ -136,14 +122,18 @@ end
136
122
137
123
Construct the `Translation` transformation for translating Cartesian points.
138
124
"""
139
- immutable Translation{T } <: AbstractTranslation
140
- dx:: T
125
+ immutable Translation{VectorT } <: AbstractTranslation
126
+ dx:: VectorT
141
127
end
142
128
Translation (x:: Tuple ) = Translation (Vec (x))
143
129
Translation (x,y) = Translation (Vec (x,y))
144
130
Translation (x,y,z) = Translation (Vec (x,y,z))
145
131
Base. show (io:: IO , trans:: Translation ) = print (io, " Translation$((trans. dx... )) " )
146
132
133
+ @compat function (trans:: Translation{V} ){V}(x)
134
+ x + translation_vector (trans)
135
+ end
136
+
147
137
translation_vector (trans:: Translation ) = trans. dx
148
138
149
139
# Generic definitions that capture all `Translation`s.
@@ -174,6 +164,11 @@ LinearTransformation(trans::AbstractLinearTransformation) = LinearTransformation
174
164
175
165
Base. show (io:: IO , trans:: LinearTransformation ) = print (io, " LinearTransformation($(trans. M) )" ) # TODO make this output more petite
176
166
167
+ @compat function (trans:: LinearTransformation{M} ){M}(x)
168
+ transformation_matrix (trans) * x
169
+ end
170
+
171
+
177
172
@inline transformation_matrix (trans:: LinearTransformation ) = trans. M
178
173
179
174
# Generic definitions
@@ -209,6 +204,10 @@ function AffineTransformation(trans::AbstractAffineTransformation)
209
204
AffineTransformation (transformation_matrix (trans), translation_vector (trans))
210
205
end
211
206
207
+ @compat function (trans:: AffineTransformation{M,V} ){M,V}(x)
208
+ transformation_matrix (trans) * x + translation_vector (trans)
209
+ end
210
+
212
211
# We can create an Affine transformation corresponding to the differential
213
212
# transformation of x + dx
214
213
#
0 commit comments