【问题标题】:Is it possible to combine Convolution Matrices to apply several transformations at once?是否可以结合卷积矩阵一次应用多个变换?
【发布时间】:2011-12-20 07:35:24
【问题描述】:

理论上,应该可以通过加法或乘法来组合变换或颜色矩阵(当涉及到这样的数学时,我很蹩脚)。有可能吗?

【问题讨论】:

    标签: actionscript-3 matrix transformation convolution


    【解决方案1】:

    是的!在 Flash 中,卷积矩阵在 flash.geom 包中定义。变换矩阵是Matrix,颜色矩阵是ColorTransform。两者都实现了concat 函数,让您可以将另一个矩阵的效果相乘。

    var a:Matrix = new Matrix();
    a.translate(60, 40);
    
    var b:Matrix = new Matrix();
    b.rotate(60);
    
    a.concat(b); // Matrix a now translates and rotates whatever it convolutes.
    

    【讨论】:

    • 但是你知道这背后的实际逻辑是什么吗?我想将它移植到 JavaScript?
    • 纯粹是矩阵乘法,所以任何关于矩阵乘法的文章都会告诉你怎么做。您也可以考虑在math.stackexchange.com 中提问。不过,在代码中滚动您自己的矩阵实现可能有点棘手。考虑使用库,例如​​ sylvester.jcoglan.com
    猜你喜欢
    • 2013-07-27
    • 1970-01-01
    • 2011-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多