示例#1
0
        public Matrix3 Invert()
        {
            // Lazy, terribly inefficent way to do this.
            // do this properly (without thunking to unmanaged code) another time.
            IMatrix3 cppversion = _IMatrix3;

            cppversion.Invert();
            return(new Matrix3(cppversion));
        }
示例#2
0
        public static float[] GetTranslation(IINode node, IINode renderedNode)
        {
            float[] res = new float[3];
            //IPoint3 translation =  node.GetNodeTM(0, Tools.Forever).Trans; //position relative to parent, translation

            IObject  obj        = node.ObjectRef;
            IBox3    bbox       = obj.GetWorldBoundBox(0, node, Loader.Core.ActiveViewExp);
            IPoint3  bboxCenter = bbox.Center;
            IMatrix3 inverted   = renderedNode.GetNodeTM(0, Tools.Forever);

            inverted.Invert();
            IPoint3 bboxCenterInRenderNodeSpace = inverted.PointTransform(bboxCenter);


            res[0] = bboxCenterInRenderNodeSpace.X;
            res[1] = bboxCenterInRenderNodeSpace.Z;
            res[2] = -bboxCenterInRenderNodeSpace.Y;

            return(res);
        }
示例#3
0
        public static float[] GetRotation(IINode node, IINode renderedNode)
        {
            float[]  res      = new float[4];
            IMatrix3 nodeTm   = node.GetNodeTM(0, Tools.Forever);
            IMatrix3 inverted = renderedNode.GetNodeTM(0, Tools.Forever);

            inverted.Invert();
            nodeTm = nodeTm.Multiply(inverted);

            IPoint3 p = Loader.Global.Point3.Create(0, 0, 0);
            IQuat   q = Loader.Global.IdentQuat;
            IPoint3 s = Loader.Global.Point3.Create(0, 0, 0);

            Loader.Global.DecomposeMatrix(nodeTm, p, q, s);

            q.Normalize();

            res[0] = q[0];
            res[1] = q[2];
            res[2] = -q[1];
            res[3] = -q[3];

            return(res);
        }