Giter Club home page Giter Club logo

affinetransforms.jl's Introduction

AffineTransforms

Build Status

A package for working with affine transformations.

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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.