A Personal Understanding to Matrix Transformation in Graphics
A Personal Understanding to Matrix Transformation in Graphics
-------------------------------------------------------------
Matrix Transformation is a vital important concept for people who are at their beginning of learning Graphics. And this concept usually get hard to learn, especially from a mathematical perspective. This article, however, is not going to elaborate such a theory by an arithmetic way. Instead I'll just focus on a single topic and talk about what I got from that.
What I'm going to talk is "how to understand that more than one matrix integrate into one result matrix which will then be applied to a vertex to make it transformed."
=================
Let's start from the simplest case, there's only one matrix applied to a vertex, which is written like this:
Va = [M1] * Vb
It's obvious that "Vb" is transformed to "Va" through the matrix "[M1]". But on the other side, we can think this formula from another meaning, which is in fact the essential idea in this article. Before explaining the idea, let's give a little background knowledge first : the default coordinate in which we're drawing objects is actually a kind of matrix and let's call it "[M0]" for example. With this hidden matrix exposed out, we can replace the formula as this :
Va = [M0] * [M1] * Vb
Now the idea comes. We can see the representation as that the default coordinate(matrix) "[M0]" is transformed by the other matrix "[M1]" and turned into a new coordinate, and then, "Vb" is just drawn at the location as it is, but in this new coordinate. the value of "Va" represents the location of "Vb" where we look it from the default coordinate("[M0]").
So briefly speaking, There are two understandings to the same formula, just from two directions opposed to each other.
---------------> (a)
Va = [M0] * [M1] * Vb
<--------------- (b)
(a) stands at the "coordinate"'s view to see the transformation. A coordinate turns into others one by one from left to right side, and in the final result coordinate, the vertex is drawn to the location where it's value reflects.
And (b) see the transformation standing from the "vertex"'s view. A vertex is applied by a matrix and turns into another vertex with the different location. And the new vertex continues the transformation until the last matrix is applied to it. And eventually we draw this result vertex under the default coordinate ("[M0]").
Both thoughts get the same result. "Va", the left side of the equation, represents the original "Vb" is transformed to a new location where now "Va" lies in the default coordinate "[M0]". This is a good example showing "consider the same one thing from more than one aspects".
=================
It's time I give a practical case using this philosophy now, still a simple case, though. Suppose there is an arbitrary object composed of vertices(ex. a triangle with 3 vertices) in the default coordinate "[M0]". What if we want to firstly move it to somewhere, and secondly make it self-rotated, which means rotate around its own axes?
Let's break this question down. Actually our question include two transformations, MOVE and ROTATE, each can be represented by a matrix. we'll give them a name respectively, "[T]" for MOVE("Translation") and "[R]" for ROTATE("Rotation"). We know that these two matrices will be integrate to one final matrix and be applied to the object vertices, but what's the sequence of mixing? The different order, results in the different effect. So now we touched the core the question.
The answer is simple. If we adopt the idea (a), The order is alike with the way we describes the requirement. First we move the coordinate to somewhere and then rotate the coordinate to some angles. And at last we draw the object on that transformed coordinate. While if we adopt the idea (b), what we should do is to rotate the object first and move this rotated object to somewhere we're aiming on the unchanged and default matrix. Both formulas are same:
---------------> (a)
OBJa = [T] * [R] * OBJb
<--------------- (b)
=================
A little advanced example enhancing the above case is to take the "Camera View Transformation" into the consideration. We know "Camera View Transformation" is also a kind of matrix and so it can be thought as such. I don't want to go to the details too much here except only a note that the movement relationship between a camera and objects is relative. If the camera moves forward 10 steps, this also means the whole objects in the scene move backward 10 steps with the camera keeps unmoved.
Since what we're transforming is objects rather than the camera, we should take the inversed matrix of cameras' as the transforming matrix, we call it "Inv([C])", for example. The formula finally looks like this :
------------------------> (a)
OBJa = Inv([C]) * [T] * [R] * OBJb
<------------------------ (b)
A Personal Understanding to Matrix Transformation in Graphics的更多相关文章
- The history of programming languages.(transshipment) + Personal understanding and prediction
To finish this week's homework that introduce the history of programming languages , I surf the inte ...
- Matrix Transformation codechef 数学题
https://www.codechef.com/problems/MTRNSFRM 我只能说codechef的题好劲爆,这题居然是easy的题,太可怕了.而且还有一点就是codechef的题解很难看 ...
- android.graphics.Matrix
Matrix类包含了一个3x3的矩阵用来改变坐标,它没有一个构造器来初始化它里边的内容,所以创建实例后需要调用reset()方法生成一个标准matrix,或者调用set..一类的函数,比如setTra ...
- [Android]android.graphics.Camera实现图像的旋转、缩放,配合Matrix实现图像的倾斜
android.graphics.Camera可以对图像执行一些比较复杂的操作,诸如旋转与绽放,与Matrix可实现图像的倾斜. 个人总结Camera与Matrix的一些区别如下: Camera的ro ...
- Matrix: android 中的Matrix (android.graphics.Matrix) (转)
本篇博客主要讲解一下如何处理对一个Bitmap对象进行处理,包括:缩放.旋转.位移.倾斜等.在最后将以一个简单的Demo来演示图片特效的变换. 1. Matrix概述 对于一个图片变换的处理,需要Ma ...
- UNITY_MATRIX_IT_MV[Matrix] (转载)
转载 http://blog.csdn.net/cubesky/article/details/38682975 前面发了一篇关于unity Matrix的文章. http://blog.csdn.n ...
- 【转】2D动画:view的Matrix
Matrix,中文里叫矩阵,高等数学里有介绍,在图像处理方面,主要是用于平面的缩放.平移.旋转等操作. 首先介绍一下矩阵运算.加法和减法就不用说了,太简单了,对应位相加就好.图像处理,主要用到的是乘法 ...
- UNITY_MATRIX_IT_MV[Matrix]
http://blog.csdn.net/cubesky/article/details/38682975 前面发了一篇关于unity Matrix的文章. http://blog.csdn.NET/ ...
- Matrix(单点移动,多点缩放)
package cn.iris.matrixapi; import android.app.Activity; import android.graphics.Matrix; import andro ...
随机推荐
- (打表+优化)简单的求和 -- zzuli -- 1783
http://acm.zzuli.edu.cn/problem.php?id=1783 1783: 简单的求和 Time Limit: 1 Sec Memory Limit: 128 MBSubmi ...
- ajax请求也可以用form表单向后台提交数据!!!!
激动的我简直语无伦次,不说了上代码,用ajax实现form表单数据的请求,啦啦啦啦 html: <form> <input name="userName" val ...
- 3D打印软件工具
切片与工艺规划(打印)软件: 3D打印中另外两个重要的步骤(切片和打印)中可以用到的一些开源,免费的软件和应用 Cura 开源, 免费 Python ...
- hdu 5051 找规律?+大trick
http://acm.hdu.edu.cn/showproblem.php?pid=5051 打表找规律 据说是http://zh.wikipedia.org/wiki/%E6%9C%AC%E7%A6 ...
- zoj3820
题意:给定一个树,找出两个点,使得其他点到最近的点的距离最小 思路: 牡丹江站的B题..可惜当时坑的不大对,最后也没写完.. 1.题解方法: 基于一个结论,答案一定在直径上(证明我不会).. 那么,可 ...
- [zjoi2010]cheese
题目: 贪吃的老鼠(cheese.c/cpp/pas/in/out) 时限:每个测试点10秒 [问题描述] 奶酪店里最近出现了m只老鼠!它们的目标就是把生产出来的所有奶酪都吃掉.奶酪店中一天会生产n块 ...
- zoj2607
题意:如左图,给定A,B,C,D的面积分别为大于等于a,b,c,d,求最小的面积 思路:因为a,b肯定有一个是满的(不然还可压缩到更小),同理,ac,bd,cd都只有一个是满的,所以有可能是对角满的, ...
- hive函数 parse_url的使用
hive提供了直接处理url的函数 parse_url desc funtion 的解释是: parse_url(url, partToExtract[, key]) - extracts a par ...
- 二、RHCSA试题解析
一.设置YUM仓库 YUM的软件库源地址为:http://content.example.com/rhel7.0/x86_64/dvd,将此配置为操作系统的默认软件仓库. 方法一(修改配置文件): v ...
- js gettext
test.php 1 <?php $locale='zh_CN'; if(isSet($_GET["locale"]))$locale = $_GET["local ...