Skip to content

Commit d270099

Browse files
author
Andy Ferris
committed
PR fixes
1 parent a2d47b1 commit d270099

File tree

2 files changed

+6
-57
lines changed

2 files changed

+6
-57
lines changed

src/CoordinateTransformations.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ export SphericalFromCartesian, CartesianFromSpherical,
4040
CylindricalFromSpherical, SphericalFromCylindrical
4141

4242
# Common transformations
43-
export AbstractAffineTransformation
43+
export AbstractAffineTransformation, AbstractLinearTransformation, AbstractTranslation
4444
export AffineTransformation, LinearTransformation, Translation, transformation_matrix, translation_vector, translation_vector_reverse
45-
export affine_decomposition_T_of_L, affine_decomposition_L_of_T
4645
export RotationPolar, Rotation2D
4746
export Rotation, RotationXY, RotationYZ, RotationZX
4847
export RotationYX, RotationZY, RotationXZ, euler_rotation

src/commontransformations.jl

Lines changed: 5 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function Base.inv(trans::AbstractAffineTransformation)
3939
AffineTransformation(Minv, -Minv * translation_vector(trans))
4040
end
4141

42-
function Base.isapprox(t1::AbstractAffineTransformation, t2::AbstractAffineTransformation, kwargs...)
42+
function Base.isapprox(t1::AbstractAffineTransformation, t2::AbstractAffineTransformation; kwargs...)
4343
isapprox(transformation_matrix(t1), transformation_matrix(t2); kwargs...) &&
4444
isapprox(translation_vector(t1), translation_vector(t2); kwargs...)
4545
end
@@ -84,49 +84,24 @@ end
8484

8585
# transform_deriv() identical to that provided by AbstractAffineTransformation
8686

87-
function Base.isapprox(t1::AbstractLinearTransformation, t2::AbstractLinearTransformation, kwargs...)
87+
function Base.isapprox(t1::AbstractLinearTransformation, t2::AbstractLinearTransformation; kwargs...)
8888
isapprox(transformation_matrix(t1), transformation_matrix(t2); kwargs...)
8989
end
9090

9191
# These functions are remove any reference to unnecessary calls to
9292
# translation_vector(::LinearTransformation) from the AbstractAffineTransformations
9393
# interface:
9494

95-
function Base.isapprox(t1::AbstractAffineTransformation, t2::AbstractLinearTransformation, kwargs...)
95+
function Base.isapprox(t1::AbstractAffineTransformation, t2::AbstractLinearTransformation; kwargs...)
9696
isapprox(transformation_matrix(t1), transformation_matrix(t2); kwargs...) &&
9797
isapprox(norm(translation_vector(t1)), 0; kwargs...)
9898
end
9999

100-
function Base.isapprox(t1::AbstractLinearTransformation, t2::AbstractAffineTransformation, kwargs...)
100+
function Base.isapprox(t1::AbstractLinearTransformation, t2::AbstractAffineTransformation; kwargs...)
101101
isapprox(transformation_matrix(t1), transformation_matrix(t2); kwargs...) &&
102102
isapprox(norm(translation_vector(t2)), 0; kwargs...)
103103
end
104104

105-
#=
106-
"""
107-
abstract AbstractRotation <: AbstractLinearTransformation
108-
109-
Provides an interface for implementing rotations of Cartesian coordinates. To
110-
implement an AbstractRotation, you must define
111-
112-
transformation_matrix(trans)
113-
114-
where the resulting transformation is (equivalent to)
115-
116-
trans(x) -> transformation_matrix(trans) * x
117-
118-
Specific implementations may provide equivalent specializations of `call`, etc,
119-
for optimization purposes. The major difference with AbstractLinearTransformation
120-
is that the matrix is assumed to be orthogonal/unitary for the purpose of
121-
inverting the transformation.
122-
123-
(See also Rotation, AxisRotation, AbstractLinearTransformation)
124-
"""
125-
abstract AbstractRotation <: AbstractLinearTransformation
126-
127-
transformation_matrix(trans::AbstractRotation) = error("AbstractRotation $(typeof(trans)) must implement transformation_matrix()")
128-
=#
129-
130105

131106
"""
132107
abstract AbstractTranslation <: AbstractAffineTransformation
@@ -332,11 +307,6 @@ function transformation_matrix(trans::Rotation2D)
332307
trans.sin trans.cos ]
333308
end
334309

335-
function transformation_matrix(trans::Rotation2D)
336-
@fsa [ trans.cos -trans.sin;
337-
trans.sin trans.cos ]
338-
end
339-
340310
function transform_deriv{T}(trans::Rotation2D, x::Polar{T})
341311
@fsa [ zero(T) zero(T);
342312
zero(T) one(T) ]
@@ -348,6 +318,7 @@ function transform_deriv_params(trans::Rotation2D, x)
348318
trans.cos*x[1] - trans.sin*x[2] )
349319
end
350320

321+
# I don't think this will work in my new vision for rotations...
351322
function transform_deriv_params{T}(trans::Rotation2D, x::Polar{T})
352323
@fsa [ zero(T);
353324
one(T) ]
@@ -617,13 +588,6 @@ end
617588
-trans.sin Z trans.cos] * x
618589
end
619590

620-
function transform_deriv(trans::RotationXY, x)
621-
Z = zero(trans.cos)
622-
I = one(trans.cos)
623-
@fsa [ trans.cos -trans.sin Z;
624-
trans.sin trans.cos Z;
625-
Z Z I]
626-
end
627591
function transformation_matrix(trans::RotationXY)
628592
Z = zero(trans.cos)
629593
I = one(trans.cos)
@@ -632,13 +596,6 @@ function transformation_matrix(trans::RotationXY)
632596
Z Z I]
633597
end
634598

635-
function transform_deriv(trans::RotationYZ, x)
636-
Z = zero(trans.cos)
637-
I = one(trans.cos)
638-
@fsa [ I Z Z;
639-
Z trans.cos -trans.sin;
640-
Z trans.sin trans.cos ]
641-
end
642599
function transformation_matrix(trans::RotationYZ)
643600
Z = zero(trans.cos)
644601
I = one(trans.cos)
@@ -647,13 +604,6 @@ function transformation_matrix(trans::RotationYZ)
647604
Z trans.sin trans.cos ]
648605
end
649606

650-
function transform_deriv(trans::RotationZX, x)
651-
Z = zero(trans.cos)
652-
I = one(trans.cos)
653-
@fsa [ trans.cos Z trans.sin;
654-
Z I Z ;
655-
-trans.sin Z trans.cos ]
656-
end
657607
function transformation_matrix(trans::RotationZX)
658608
Z = zero(trans.cos)
659609
I = one(trans.cos)

0 commit comments

Comments
 (0)