dojo.gfx 矩阵变换
矩阵变换让我头晕目眩。我有一个 dojox.gfx.group,我想用 Mover 拖动它,然后能够围绕表面上的某个点旋转它。我的基本代码如下所示:
this.m = dojox.gfx.matrix,
.
.
.
updateMatrix: function(){
var mtx = this.group._getRealMatrix();
var trans_m = this.m.translate(mtx.dx, mtx.dy);
this.group.setTransform([this.m.rotateAt(this.rotation, 0, 0), trans_m]);
}
旋转点位于 (0,0) 只是为了简单起见。我似乎不明白这个小组是如何轮换的。
任何有关矩阵变换的简单教程的参考也会有所帮助。我检查过的那些并没有太大帮助。
Matrix transformations has got my head spinning. I've got a dojox.gfx.group which I want to be draggable with Mover and then be able to rotate it around a certain point on the surface. My basic code looks like this:
this.m = dojox.gfx.matrix,
.
.
.
updateMatrix: function(){
var mtx = this.group._getRealMatrix();
var trans_m = this.m.translate(mtx.dx, mtx.dy);
this.group.setTransform([this.m.rotateAt(this.rotation, 0, 0), trans_m]);
}
The rotation point is at (0,0) just to keep things simple. I don't seem to understand how the group is being rotated.
Any reference to simplistic tutorial on matrix transformations would also help. The ones I've checked out haven't help too much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试官方 dojox.gfx 矩阵教程。查看官方文档是否有帮助。
Try the official dojox.gfx matrix tutorial. See if the official documentation helps.
官方文档是我开始旋转的地方。我已经盯着这个问题很长一段时间了,因为我不知道如何将新坐标输入到即将到来的矩阵转换中。
我终于设法找出问题所在。这是一个将监听器连接到 Mover 何时触发 onMoveStop 的问题:
然后我获取新的移动距离并将它们输入到我的图形类中的任何旋转或缩放矩阵转换中:
Life's dandy Again。感谢尤金的建议。
The official documentation is where my head started spinning. Been staring at that for quite a long time because I couldn't make out how to feed the new coordinates into upcoming matrix transformations.
I've finally managed to figure out the problem though. It was a matter of connecting a listener to when the Mover triggers onMoveStop:
I then get the new moved distances and feed them into any rotation or scaling matrix translations in my graphic class:
Life's dandy again. Thanks Eugene for the suggestions.