【发布时间】:2019-12-03 23:37:27
【问题描述】:
我想知道两个矩阵之间的局部变换。
所以例如我有这个:
Mat3 m = m3_identity();
m = mult(m, imgui.math.rotation(radians(22)));
m = mult(m, imgui.math.translation(100, 0));
Mat3 m2 = mult(m, imgui.math.rotation(radians(45)));
m2 = mult(m2, imgui.math.translation(100, 0));
Mat3 m3 = mult(m2, imgui.math.translation(100, 0));
// trash from here on
float tx = m3.m[0][2];
float ty = m3.m[1][2];
float parent_tx = m2.m[0][2];
float parent_ty = m2.m[1][2];
tx -= parent_tx;
ty -= parent_ty;
println(tx, ty); // expected 100, 0, got 39.07, 92.05
这会给:
我的目标是拥有嵌套元素,我开始使用它,但我想展示它们的值。
举个例子,在搅拌机中我们可以有嵌套元素(子元素)。
现在如果我们有最后一个立方体并查看变换属性:
从父母的角度来看它们是这样的:
所以就我而言,我想知道从 m2 看到的 m3 的变换。
所以在这种情况下应该是 x 100 和 y 0。
我该怎么做?
如果有帮助的话,我的矩阵就这样了:
static public class Mat3 {
public float[][] m = new float[3][3];
}
【问题讨论】:
标签: math language-agnostic coordinate-transformation