1
- abstract AbstractAffineTransformation <: Transformation
1
+ abstract AbstractAffineMap <: Transformation
2
2
3
3
"""
4
- Translation(v) <: AbstractAffineTransformation
4
+ Translation(v) <: AbstractAffineMap
5
5
Translation(dx, dy) (2D)
6
6
Translation(dx, dy, dz) (3D)
7
7
8
8
Construct the `Translation` transformation for translating Cartesian points by
9
9
an offset `v = (dx, dy, ...)`
10
10
"""
11
- immutable Translation{V <: AbstractVector } <: AbstractAffineTransformation
11
+ immutable Translation{V <: AbstractVector } <: AbstractAffineMap
12
12
v:: V
13
13
end
14
14
Translation (x:: Tuple ) = Translation (SVector (x))
35
35
36
36
37
37
"""
38
- LinearTransformation <: AbstractAffineTransformation
39
- LinearTransformation (M)
38
+ LinearMap <: AbstractAffineMap
39
+ LinearMap (M)
40
40
41
- A general linear transformation, constructed using `LinearTransformation (M)`
41
+ A general linear transformation, constructed using `LinearMap (M)`
42
42
for any `AbstractMatrix` `M`.
43
43
"""
44
- immutable LinearTransformation {M <: AbstractMatrix } <: AbstractAffineTransformation
44
+ immutable LinearMap {M <: AbstractMatrix } <: AbstractAffineMap
45
45
m:: M
46
46
end
47
- Base. show (io:: IO , trans:: LinearTransformation ) = print (io, " LinearTransformation ($(trans. M) )" ) # TODO make this output more petite
47
+ Base. show (io:: IO , trans:: LinearMap ) = print (io, " LinearMap ($(trans. M) )" ) # TODO make this output more petite
48
48
49
- function (trans:: LinearTransformation {M} ){M}(x)
49
+ function (trans:: LinearMap {M} ){M}(x)
50
50
trans. m * x
51
51
end
52
52
53
- Base. inv (trans:: LinearTransformation ) = LinearTransformation (inv (trans. m))
53
+ Base. inv (trans:: LinearMap ) = LinearMap (inv (trans. m))
54
54
55
- compose (t1:: LinearTransformation , t2:: LinearTransformation ) = LinearTransformation (t1. m * t2. m)
55
+ compose (t1:: LinearMap , t2:: LinearMap ) = LinearMap (t1. m * t2. m)
56
56
57
- function Base. isapprox (t1:: LinearTransformation , t2:: LinearTransformation ; kwargs... )
57
+ function Base. isapprox (t1:: LinearMap , t2:: LinearMap ; kwargs... )
58
58
isapprox (t1. m, t2. m; kwargs... )
59
59
end
60
60
61
- function Base. isapprox (t1:: LinearTransformation , t2:: Translation ; kwargs... )
61
+ function Base. isapprox (t1:: LinearMap , t2:: Translation ; kwargs... )
62
62
isapprox (vecnorm (t1. m), 0 ; kwargs... ) &&
63
63
isapprox (vecnorm (t2. v),0 ; kwargs... )
64
64
end
65
65
66
- function Base. isapprox (t1:: Translation , t2:: LinearTransformation ; kwargs... )
66
+ function Base. isapprox (t1:: Translation , t2:: LinearMap ; kwargs... )
67
67
isapprox (vecnorm (t1. v), 0 ; kwargs... ) &&
68
68
isapprox (vecnorm (t2. m),0 ; kwargs... )
69
69
end
70
70
71
- function Base.:(== )(t1:: LinearTransformation , t2:: Translation )
71
+ function Base.:(== )(t1:: LinearMap , t2:: Translation )
72
72
vecnorm (t1. m) == 0 &&
73
73
0 == vecnorm (t2. v)
74
74
end
75
75
76
- function Base.:(== )(t1:: Translation , t2:: LinearTransformation )
76
+ function Base.:(== )(t1:: Translation , t2:: LinearMap )
77
77
vecnorm (t1. v) == 0 &&
78
78
vecnorm (t2. m) == 0
79
79
end
80
80
81
- transform_deriv (trans:: LinearTransformation , x) = trans. m
81
+ transform_deriv (trans:: LinearMap , x) = trans. m
82
82
# TODO transform_deriv_params
83
83
84
84
"""
85
- AffineTransformation <: AbstractAffineTransformation
85
+ AffineMap <: AbstractAffineMap
86
86
87
87
A concrete affine transformation. To construct the mapping `x -> M*x + v`, use
88
88
89
- AffineTransformation (M, v)
89
+ AffineMap (M, v)
90
90
91
91
where `M` is a matrix and `v` a vector. An arbitrary `Transformation` may be
92
92
converted into an affine approximation by linearizing about a point `x` using
93
93
94
- AffineTransformation (trans, [x])
94
+ AffineMap (trans, [x])
95
95
96
96
For transformations which are already affine, `x` may be omitted.
97
97
"""
98
- immutable AffineTransformation {M <: AbstractMatrix , V <: AbstractVector } <: AbstractAffineTransformation
98
+ immutable AffineMap {M <: AbstractMatrix , V <: AbstractVector } <: AbstractAffineMap
99
99
m:: M
100
100
v:: V
101
101
end
102
102
103
- function (trans:: AffineTransformation {M,V} ){M,V}(x)
103
+ function (trans:: AffineMap {M,V} ){M,V}(x)
104
104
trans. m * x + trans. v
105
105
end
106
106
@@ -109,98 +109,98 @@ end
109
109
# translation won't fix things, because then we'd have `Tx*(x-x0)` which
110
110
# also can incur large cancellation error in `x-x0`.
111
111
"""
112
- AffineTransformation (trans::Transformation, x0)
112
+ AffineMap (trans::Transformation, x0)
113
113
114
114
Create an Affine transformation corresponding to the differential transformation
115
115
of `x0 + dx` according to `trans`, i.e. the Affine transformation that is
116
116
locally most accurate in the vicinity of `x0`.
117
117
"""
118
- function AffineTransformation (trans:: Transformation , x0)
118
+ function AffineMap (trans:: Transformation , x0)
119
119
dT = transform_deriv (trans, x0)
120
120
Tx = trans (x0)
121
- AffineTransformation (dT, Tx - dT* x0)
121
+ AffineMap (dT, Tx - dT* x0)
122
122
end
123
123
124
- Base. show (io:: IO , trans:: AffineTransformation ) = print (io, " AffineTransformation ($(trans. M) , $(trans. v) )" ) # TODO make this output more petite
124
+ Base. show (io:: IO , trans:: AffineMap ) = print (io, " AffineMap ($(trans. M) , $(trans. v) )" ) # TODO make this output more petite
125
125
126
- function compose (t1:: Translation , t2:: LinearTransformation )
127
- AffineTransformation (t2. m, t1. v)
126
+ function compose (t1:: Translation , t2:: LinearMap )
127
+ AffineMap (t2. m, t1. v)
128
128
end
129
129
130
- function compose (t1:: LinearTransformation , t2:: Translation )
131
- AffineTransformation (t1. m, t1. m * t2. v)
130
+ function compose (t1:: LinearMap , t2:: Translation )
131
+ AffineMap (t1. m, t1. m * t2. v)
132
132
end
133
133
134
- function compose (t1:: AffineTransformation , t2:: AffineTransformation )
135
- AffineTransformation (t1. m * t2. m, t1. v + t1. m * t2. v)
134
+ function compose (t1:: AffineMap , t2:: AffineMap )
135
+ AffineMap (t1. m * t2. m, t1. v + t1. m * t2. v)
136
136
end
137
137
138
- function compose (t1:: AffineTransformation , t2:: LinearTransformation )
139
- AffineTransformation (t1. m * t2. m, t1. v)
138
+ function compose (t1:: AffineMap , t2:: LinearMap )
139
+ AffineMap (t1. m * t2. m, t1. v)
140
140
end
141
141
142
- function compose (t1:: LinearTransformation , t2:: AffineTransformation )
143
- AffineTransformation (t1. m * t2. m, t1. m * t2. v)
142
+ function compose (t1:: LinearMap , t2:: AffineMap )
143
+ AffineMap (t1. m * t2. m, t1. m * t2. v)
144
144
end
145
145
146
- function compose (t1:: AffineTransformation , t2:: Translation )
147
- AffineTransformation (t1. m, t1. v + t1. m * t2. v)
146
+ function compose (t1:: AffineMap , t2:: Translation )
147
+ AffineMap (t1. m, t1. v + t1. m * t2. v)
148
148
end
149
149
150
- function compose (t1:: Translation , t2:: AffineTransformation )
151
- AffineTransformation (t2. m, t1. v + t2. v)
150
+ function compose (t1:: Translation , t2:: AffineMap )
151
+ AffineMap (t2. m, t1. v + t2. v)
152
152
end
153
153
154
- function Base. inv (trans:: AffineTransformation )
154
+ function Base. inv (trans:: AffineMap )
155
155
m_inv = inv (trans. m)
156
- AffineTransformation (m_inv, m_inv * (- trans. v))
156
+ AffineMap (m_inv, m_inv * (- trans. v))
157
157
end
158
158
159
- function Base. isapprox (t1:: AffineTransformation , t2:: AffineTransformation ; kwargs... )
159
+ function Base. isapprox (t1:: AffineMap , t2:: AffineMap ; kwargs... )
160
160
isapprox (t1. m, t2. m; kwargs... ) &&
161
161
isapprox (t1. v, t2. v; kwargs... )
162
162
end
163
163
164
- function Base. isapprox (t1:: AffineTransformation , t2:: Translation ; kwargs... )
164
+ function Base. isapprox (t1:: AffineMap , t2:: Translation ; kwargs... )
165
165
isapprox (vecnorm (t1. m), 0 ; kwargs... ) &&
166
166
isapprox (t1. v, t2. v; kwargs... )
167
167
end
168
168
169
- function Base. isapprox (t1:: Translation , t2:: AffineTransformation ; kwargs... )
169
+ function Base. isapprox (t1:: Translation , t2:: AffineMap ; kwargs... )
170
170
isapprox (vecnorm (t2. m), 0 ; kwargs... ) &&
171
171
isapprox (t1. v, t2. v; kwargs... )
172
172
end
173
173
174
- function Base. isapprox (t1:: AffineTransformation , t2:: LinearTransformation ; kwargs... )
174
+ function Base. isapprox (t1:: AffineMap , t2:: LinearMap ; kwargs... )
175
175
isapprox (t1. m, t2. m; kwargs... ) &&
176
176
isapprox (vecnorm (t1. v), 0 ; kwargs... )
177
177
end
178
178
179
- function Base. isapprox (t1:: LinearTransformation , t2:: AffineTransformation ; kwargs... )
179
+ function Base. isapprox (t1:: LinearMap , t2:: AffineMap ; kwargs... )
180
180
isapprox (t1. m, t2. m; kwargs... ) &&
181
181
isapprox (0 , vecnorm (t2. v); kwargs... )
182
182
end
183
183
184
184
185
- function Base.:(== )(t1:: AffineTransformation , t2:: Translation )
185
+ function Base.:(== )(t1:: AffineMap , t2:: Translation )
186
186
vecnorm (t1. m) == 0 &&
187
187
t1. v == t2. v
188
188
end
189
189
190
- function Base.:(== )(t1:: Translation , t2:: AffineTransformation )
190
+ function Base.:(== )(t1:: Translation , t2:: AffineMap )
191
191
vecnorm (t2. m) == 0 &&
192
192
t1. v == t2. v
193
193
end
194
194
195
- function Base.:(== )(t1:: AffineTransformation , t2:: LinearTransformation )
195
+ function Base.:(== )(t1:: AffineMap , t2:: LinearMap )
196
196
t1. m == t2. m &&
197
197
vecnorm (t1. v) == 0
198
198
end
199
199
200
- function Base.:(== )(t1:: LinearTransformation , t2:: AffineTransformation )
200
+ function Base.:(== )(t1:: LinearMap , t2:: AffineMap )
201
201
t1. m == t2. m &&
202
202
0 == vecnorm (t2. v)
203
203
end
204
204
205
- transform_deriv (trans:: AffineTransformation , x) = trans. m
205
+ transform_deriv (trans:: AffineMap , x) = trans. m
206
206
# TODO transform_deriv_params
0 commit comments