Well, that was easy:
public static function
getArcballMatrix(n1:Number3D,n2:Number3D,center:Number3D=
null,oMatrix:MatrixAway3D=null):MatrixAway3D
                {

                        if(center == null) center = new Number3D;
                                        // var center:Number3D = 
obj.scenePivotPoint//new
Number3D(0,0,0)//uiball.position//new Number3D(0,0,0);
                        var p1:Number3D =n1
                        p1.sub(p1,center);
                                        // p1.y = -p1.y;
                        var p2:Number3D = new Number3D;
                        p2.clone(n2);
                                         //p2.scale(p2,.1);
                                        //p2.y = -p2.y;
                        p2.sub(p2,center);
                                         //trace(nn2,cP)
                     // c; //0,0,0
                        p1.normalize();
                        p2.normalize()
                        var cross:Number3D = new Number3D;
                        cross.cross(p1,p2);
                        var pos:Array = [cross.x,cross.y,cross.z]
                        var len:Number = cross.modulo;
                        var angle:Number = Math.acos(len)

                        var q:Quaternion = new Quaternion;
                        q.axis2quaternion(pos[0],pos[1],pos[2],angle);
                        //q.normalize(1)
                        var mat:MatrixAway3D = new MatrixAway3D;
                        mat.quaternion2matrix(q);


                        if(oMatrix){
                                mat.multiply3x3( mat, oMatrix);
                                //mat.normalize(oMatrix)
                        }
                        return mat;
                }

only trouble is that one axis of motion needs to be flipped...

Reply via email to