Giter VIP home page Giter VIP logo

Comments (2)

GcsSloop avatar GcsSloop commented on June 6, 2024
  • 首先、探讨此问题前请确保理解矩阵概念,以及明白矩阵乘法的运算方式
  • 其次、了解下面矩阵中每一个位置数值的作用。

![](http://latex.codecogs.com/png.latex?
$$
\left [
\begin{matrix}
MSCALE_X & MSKEW_X & MTRANS_X \
\
MSKEW_Y & MSCALE_Y & MTRANS_Y \
\
MPERSP_0 & MPERSP_1 & MPERSP_2
\end{1}
\right ]
$$)

以上是前提条件,如果不理解这些内容以下所有说明都是白搭。

  • 概念一、矩阵乘法不满足交换律,即 A_B ≠ B_A
  • 概念二、pre相当于矩阵的右乘,而post相当于矩阵的左乘
  • 概念三、程序每一步运算都会得到确定的结果
  • 概念四、根据矩阵乘法运算规则可得,每一次矩阵相乘都会受到其中的所有元素影响,左乘和右乘影响的结果也不同。

当执行 preTranslate 时会受到 MSCALE_XMSCALE_Y 的影响,具体影响如何,自己运算一遍矩阵乘法即可。
例如,当进行如下操作时

Matrix matrix = new Matrix();
matrix.preScale(0.5f, 0.8f);
matrix.preTranslate(1000, 1000);
Log.e(TAG, "MatrixTest:3" + matrix.toShortString());

执行完 preScale(0.5, 0.8),缩放为 (0.5, 0.8)
执行完 preTranslate(1000, 1000),结果平移距离为(500, 800) (概念四、每一次矩阵相乘都会受到其中的所有元素影响)
因此产生一种先执行了平移操作,之后将平移距离缩放的错觉。

最后: 矩阵(线性代数) 是一个学期的数学课程,不是我三言两语能够说明白的,(如果我有这种能力早去当教授了),矩阵相关的具体资料可以自行寻找,网上有很多。

from androidnote.

xingstarx avatar xingstarx commented on June 6, 2024

@GcsSloop 真是好心人啊 @a474790005
我最近写的一篇,没写完额,这个例子,按照矩阵乘法的顺序计算了一遍,每一步骤的结果,具体计算过程可以自己尝试,在跟我的结果对照
https://github.com/xingstarx/AndroidNote/blob/master/view/Matrix%E8%AF%A6%E8%A7%A3.md#部分疑问解读

from androidnote.

Related Issues (20)

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.