A package for working with affine transformations. For new projects, I recommend CoordinateTransformations instead.
In julia, type
An affine transformation is of the form
y = A*x + b
This is the "forward" transformation. The "inverse" transformation is therefore
x = A\(y-b)
Create an affine transformation with
tfm = AffineTransform(A, b)
The following are all different ways of computing the forward transform:
y = tfm * x y = tformfwd(tfm, x) y = similar(x); tformfwd!(y, tfm, x)
Similarly, the following are all different ways of computing the inverse transform:
x = tfm\y x = tforminv(tfm, y) x = similar(y); tforminv!(x, tfm, y)
tformeye(T, nd) tformeye(nd)
Creates the identity transformation in
Creates a shift (translation) transformation
tformrotate(angle) # creates a 2d rotation tformrotate(axis, angle) # creates a 3d rotation tformrotate(axis) # creates a 3d rotation
In 3d, these constructors work with angle-axis representation, where
axis is a 3-vector.
angle is provided,
axis is used as if it were normalized to have unit length.
If you just specify
norm(axis) is used for the
Creates a scaling transformation, where
A will have
scale along the diagonal.
Particularly useful for optimization of rigid transformations.
length(p) == 3, this creates a 2d transform, where
p is the rotation angle,
the two components of translation.
length(p) == 6, this creates a 3d transform, where
p[4:6] are the three components of translation.
Converts a 2d or 3d rotation matrix
R into an
angle (in 2d) or the
axis representation (in 3d).
3 months ago