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 ...
随机推荐
- GPT分区在IBM服务器上安装linux不能引导的解决方法
提示: Your boot partition is on a disk using the GPT partitioning Scheme but this machines cannot boot ...
- Android多线程操作sqlite(Sqlite解决database locked问题)
参考http://blog.csdn.net/sdsxleon/article/details/18259973 很好 https://github.com/2point0/Android-Data ...
- Java数据类型、赋值、类型转换、==运算
数据类型 基本数据类型:即int/char等这样的数值类型,共8种 引用类型:除了基本数据类型之外都是引用类型:包括API中的类:如String.File:也包括自定义的类:如Personal.ABC ...
- Bloom Filter 算法简介 (增加 Counting Bloom Filter 内容)
Bloom Filter的中文翻译叫做布隆过滤器,是1970年由布隆提出的.它实际上是一个很长的二进制向量和一系列随机映射函数.布隆过滤器可以用于检索一个元素是否在一个集合中.它的优点是空间效率和查询 ...
- Redis集群错误
部署Redis集群时出现如下错误: >>> Creating cluster>>> Performing hash slots allocation on 9 no ...
- [置顶] 获取网络数据中的数组显示成ListView的简单流程
首先说一下 这是我自己的个人笔记,如果想看看,不用看细节,可以看流程. 定义一个线程池 ExecutorService pool = Executors.newFixedThreadPool(15) ...
- 《principal component analysis based cataract grading and classification》学习笔记
Abstract A cataract is lens opacification caused by protein denaturation which leads to a decrease i ...
- Hibernate在PostgreSQL上执行sum函数导致数据失真的问题
有一段通过Hibernate从PostgreSQL上进行sum统计的简单代码,但统计结果却导致数据失真,不知原因何在,求指教! Java代码片段如下: public List<Object> ...
- file-loader引起的html-webpack-plugin坑
引言 最近,我们的一个后台系统要改版为基于react + redux + react-router + ant-design 技术栈,切换到当下比较新的技术来实现后台系统:在项目实施过程中,选择了基于 ...
- 「PKUSC2018」星际穿越(倍增)
倍增好题啊! 我们我们预处理 \(f[x][i]\) 表示 \(x\) 点最左到达的端点,\(sum[x][i]\) 表示 \(x\) 点最左到达的端点时 \(f[x][i]\sim x\) 的答案, ...