From 49d9010a3ce5c3274ba9c5d7dd15706a5be6d18a Mon Sep 17 00:00:00 2001 From: gauthiier Date: Tue, 3 Mar 2015 09:23:39 +0100 Subject: [PATCH] affine --- affine.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- index.md | 2 +- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/affine.md b/affine.md index f26a88c..93bc92b 100644 --- a/affine.md +++ b/affine.md @@ -5,39 +5,100 @@ title: Environment ## Affine Transforms & Vector Math + class Transformable { + + // attaributes + PVector _position; + float _rotation; + float _scale; + + ... + + public void display() { + pushMatrix(); + translate(_position.x, _position.y); + rotate(_rotation); + scale(_scale); + draw_shape(); + popMatrix(); + } + + ... + + }; + +--- + +What is a geometry / shape? + +![](http://onemathematicalcat.org/Math/Geometry_obj/graphics/vertex_vertices.png) + +--- + +What types of (2D / 3D) transformations can we apply to geometries / shapes? + +![](http://resources.esri.com/help/9.3/arcgisdesktop/com/gp_toolref/coverage_tools/transform_arc3.gif) + +--- + -Matrix multiplication +What is a matrix Matrix? + +$ +[[a, b, c], [d, e, f], [g, h, i]] +$ + + +Matrix [3 x 3] multiplication with a Vector [1 x 3] + $ [[a, b, c], [d, e, f], [g, h, i]] [[x], [y], [z]] = [[ax + by + cz], [dx + ey + fz], [gx + hy + iz]] $ +--- + +What types of geometrical transformations (vertices transformation) can we perform using a Matrix? + Translation + $ [[1, 0, tx], [0, 1, ty], [0, 0, 1]] [[x], [y], [1]] = [[dot x], [dot y], [1]] $ Scaling + $ [[sx, 0, 0], [0, sy, 0], [0, 0, 1]] [[x], [y], [1]] = [[dot x], [dot y], [1]] $ Rotation $theta$ + $ [[cos theta, -sin theta, 0], [sin theta, cos theta, 0], [0, 0, 1]] [[x], [y], [1]] = [[dot x], [dot y], [1]] $ Shearing + $ [[1, shx, 0], [shy, 1, 0], [0, 0, 1]] [[x], [y], [1]] = [[dot x], [dot y], [1]] $ -Affine Transform (Translation + Scaling + Rotation + Shearing) +--- + +What is an Affine Transform? + +Affine Transform Matrix comprises a Translation, Scaling, Rotation and Shearing + $ [[sx * cos theta, -sin theta * shx, tx], [sin theta * shy, sy * cos theta, ty], [0, 0, 1]] [[x], [y], [1]] = [[dot x], [dot y], [1]] $ +Yes, but what other types of transformations exists? + +![](https://geodata.ethz.ch/resources/tutorials/L3GeodataAndSpatialRelation/en/images/transformation.png) + diff --git a/index.md b/index.md index 8895242..6491349 100644 --- a/index.md +++ b/index.md @@ -28,7 +28,7 @@ This course not only focuses on tools, but on how these tools can become a part [Objects](objects.html) -[Environment](/) +Environment - [Affine Transformatino](affine.html) and [Oscillatiors](/) [Simulation](/)