AffineTransforms.jl
Computational geometry with affine transformations
Install / Use
/learn @timholy/AffineTransforms.jlREADME
AffineTransforms
A package for working with affine transformations. For new projects, I recommend CoordinateTransformations instead.
Installation
In julia, type
Pkg.add("AffineTransforms")
Theory
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)
Usage
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)
Convenience constructors
tformeye(T, nd)
tformeye(nd)
Creates the identity transformation in nd dimensions.
tformtranslate(v)
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.
When angle is provided, axis is used as if it were normalized to have unit length.
If you just specify axis, then norm(axis) is used for the angle.
tformscale(scale::Real, nd)
Creates a scaling transformation, where A will have scale along the diagonal.
tformrigid(p)
Particularly useful for optimization of rigid transformations.
If length(p) == 3, this creates a 2d transform, where p[1] is the rotation angle, p[2:3] are
the two components of translation.
If length(p) == 6, this creates a 3d transform, where p[1:3] is axis for tformrotate,
and p[4:6] are the three components of translation.
Representation conversions
rotationparameters(R)
Converts a 2d or 3d rotation matrix R into an angle (in 2d) or the axis representation (in 3d).
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
