Exemplo n.º 1
0
        public Cube()
        {
            /**注意:构建三角面时,从顺时针方向构建,左手坐标系**/

            //top可见使用顺时针
            triangles[0] = new Triangle3D(a, b, c);
            triangles[1] = new Triangle3D(a, c, d);

            //bottom,不可见使用逆时针
            triangles[2] = new Triangle3D(e, h, f);
            triangles[3] = new Triangle3D(f, h, g);

            //front可见使用顺时针
            triangles[4] = new Triangle3D(d, c, g);
            triangles[5] = new Triangle3D(d, g, h);

            //back不可见使用逆时针
            triangles[6] = new Triangle3D(a, e, b);
            triangles[7] = new Triangle3D(b, e, f);

            //right可见使用顺时针
            triangles[8] = new Triangle3D(b, f, c);
            triangles[9] = new Triangle3D(c, f, g);

            //left不可见使用逆时针
            triangles[10] = new Triangle3D(a, d, h);
            triangles[11] = new Triangle3D(a, h, e);
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //注意 w 的值为1 才能进行正常的矩阵变换
            //z 为 0
            Vector4 a = new Vector4(0, 0.5, 0, 1);//此时三角形顶点朝下
            Vector4 b = new Vector4(0.5, -0.5, 0, 1);
            Vector4 c = new Vector4(-0.5, -0.5, 0, 1);

            t = new Triangle3D(a, b, c);
        }