예제 #1
0
        public void ChangeView(double gyroY, double gyroX, double gyroZ, bool apply)
        {
            Inventor.Vector screenX = null;
            Inventor.Vector screenY = null;
            Inventor.Vector screenZ = null;
            screenZ = oCamera.Target.VectorTo(oCamera.Eye);
            screenZ.Normalize();

            screenY = oCamera.UpVector.AsVector();
            screenX = screenY.CrossProduct(screenZ);

            Inventor.Matrix rotX = oTG.CreateMatrix();
            rotX.SetToRotation(gyroX, screenX, oCamera.Target);

            Inventor.Matrix rotY = oTG.CreateMatrix();
            rotY.SetToRotation(gyroY, screenY, oCamera.Target);

            Inventor.Matrix rotZ = oTG.CreateMatrix();
            rotZ.SetToRotation(gyroZ, screenZ, oCamera.Target);

            Inventor.Matrix rot = oTG.CreateMatrix();
            rot = rotX;
            rot.PostMultiplyBy(rotY);
            rot.PostMultiplyBy(rotZ);
            Inventor.Point newEye = oCamera.Eye;
            newEye.TransformBy(rot);
            Inventor.UnitVector newUp = oCamera.UpVector;
            newUp.TransformBy(rot);
            oCamera.Eye      = newEye;
            oCamera.UpVector = newUp;
            if (apply)
            {
                oCamera.Apply();
            }
            else
            {
                oCamera.ApplyWithoutTransition();
            }
        }
예제 #2
0
        public void TranslateView(double scaleX, double scaleY)
        {
            Inventor.Vector X = null;
            Inventor.Vector Y = null;
            Inventor.Vector Z = null;
            Z = oCamera.Target.VectorTo(oCamera.Eye);
            Z.Normalize();

            Y = oCamera.UpVector.AsVector();
            X = Y.CrossProduct(Z);

            X.ScaleBy(scaleX);
            Y.ScaleBy(scaleY);

            Inventor.Point newEye = oCamera.Eye;
            newEye.TranslateBy(X);
            newEye.TranslateBy(Y);
            Inventor.Point newTarget = oCamera.Target;
            newTarget.TranslateBy(X);
            newTarget.TranslateBy(Y);
            oCamera.Eye    = newEye;
            oCamera.Target = newTarget;
            oCamera.ApplyWithoutTransition();
        }