Matrix dojo.gfx矩阵变换

Matrix dojo.gfx矩阵变换,matrix,dojo,gfx,Matrix,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([

矩阵变换让我头晕目眩。我有一个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),只是为了保持简单。我似乎不明白团队是如何轮换的


任何关于矩阵变换的简单教程的参考都会有所帮助。我签出的没有太多帮助。

试试。查看是否有帮助。

请尝试。看看是否有帮助。

官方文件是我开始思考的地方。我已经盯着它看了很长时间了,因为我不知道如何将新坐标输入即将到来的矩阵变换中

不过,我终于设法解决了这个问题。移动器触发onMoveStop时,需要将侦听器连接到:

dojo.connect(movable, "onMoveStop", map, "reposition");
然后,我获得新的移动距离,并将其输入到图形类中的任何旋转或缩放矩阵转换中:

updateMatrix: function(){
    //So far it is the group which is being rotated

    if (this.group) {

        if(!this.curr_matrix){
            this.curr_matrix = this.initial_matrix;
        }
        this.group.setTransform([
            this.m.rotateAt(this.rotation, this.stage_w_2, this.stage_h_2),
            this.m.scaleAt(this.scaling, this.stage_w_2, this.stage_h_2),
            this.curr_matrix
        ]);

        //this.group.setTransform([
        //  this.m.rotateAt(this.rotation, mid_x, mid_y),
        //  this.m.scaleAt(this.scaling, mid_x, mid_y),
        //  this.initial_matrix]);
    }
},
reposition: function(){
    mtx = this.group._getRealMatrix();
    this.curr_matrix = this.m.translate(mtx.dx, mtx.dy);
},

生活又是美好的。谢谢尤金的建议。

官方文件是我开始思考的地方。我已经盯着它看了很长时间了,因为我不知道如何将新坐标输入即将到来的矩阵变换中

不过,我终于设法解决了这个问题。移动器触发onMoveStop时,需要将侦听器连接到:

dojo.connect(movable, "onMoveStop", map, "reposition");
然后,我获得新的移动距离,并将其输入到图形类中的任何旋转或缩放矩阵转换中:

updateMatrix: function(){
    //So far it is the group which is being rotated

    if (this.group) {

        if(!this.curr_matrix){
            this.curr_matrix = this.initial_matrix;
        }
        this.group.setTransform([
            this.m.rotateAt(this.rotation, this.stage_w_2, this.stage_h_2),
            this.m.scaleAt(this.scaling, this.stage_w_2, this.stage_h_2),
            this.curr_matrix
        ]);

        //this.group.setTransform([
        //  this.m.rotateAt(this.rotation, mid_x, mid_y),
        //  this.m.scaleAt(this.scaling, mid_x, mid_y),
        //  this.initial_matrix]);
    }
},
reposition: function(){
    mtx = this.group._getRealMatrix();
    this.curr_matrix = this.m.translate(mtx.dx, mtx.dy);
},
生活又是美好的。谢谢尤金的建议