예제 #1
0
파일: Form1.cs 프로젝트: Jokcik/KB_LAB_4
        private Vector3D[] View3D(float scale, float width, float height)
        {
            var obj    = getObj();
            var center = GetCenter(obj);

            var T  = Matrix3D.TranslateMatrix(width, height, 0);
            var S  = Matrix3D.ScaleMatrix(scale / 2);
            var T2 = Matrix3D.TranslateMatrix(center);
            var Rx = Matrix3D.XRotateMatrix(angleX);
            var Ry = Matrix3D.YRotateMatrix(angleY);
            var Rz = Matrix3D.ZRotateMatrix((angleX + angleY) / 2);
            var P  = Matrix3D.CentralProjection(10000, 10000, 500);

            var newObj = new Vector3D[obj.Length];
            var m      = T * P * S * Rx * Ry * Rz * T2;

            for (int i = 0; i < newObj.Length; i++)
            {
                newObj[i] = m * obj[i];
                newObj[i].Normalize();
            }

            return(newObj);
        }