コード例 #1
0
ファイル: Triangle3D.cs プロジェクト: CedricHanebaum/Dame
        public static TriangleISO Triangle3DToISO(Triangle3D t)
        {
            Point p1, p2, p3;
            p1 = Vector3D.Vector3DToISO(t.getV1());
            p2 = Vector3D.Vector3DToISO(t.getV2());
            p3 = Vector3D.Vector3DToISO(t.getV3());

            return new TriangleISO(p1, p2, p3, t.getColor());
        }
コード例 #2
0
ファイル: Board3D.cs プロジェクト: CedricHanebaum/Dame
        public Board3D(Vector3D basePoint, int size)
            : base(basePoint)
        {
            if (!(size == 8 || size == 10)) throw new ArgumentException();
            this.size = size;

            for (int i = 0; i < size; i++) {
                for (int j = 0; j < size; j++) {
                    Color color = (i + j) % 2 == 0 ? COLOR_WHITE: COLOR_BLACK;

                    Triangle3D[] rect = this.getRect(i * RECTSIZE, j * RECTSIZE, color);

                    this.addTriangle(rect[0]);
                    this.addTriangle(rect[1]);
                }
            }

            Vector3D v01 = new Vector3D(0, 0, 0);
            Vector3D v02 = new Vector3D(RECTSIZE * size, 0, 0);
            Vector3D v03 = new Vector3D(0, RECTSIZE * size, 0);
            Vector3D v04 = new Vector3D(RECTSIZE * size, RECTSIZE * size, 0);

            Vector3D v05 = v01 + new Vector3D(-EDGEWIDTH, -EDGEWIDTH, 0);
            Vector3D v06 = v02 + new Vector3D(EDGEWIDTH, -EDGEWIDTH, 0);
            Vector3D v07 = v03 + new Vector3D(-EDGEWIDTH, EDGEWIDTH, 0);
            Vector3D v08 = v04 + new Vector3D(EDGEWIDTH, EDGEWIDTH, 0);

            Vector3D v09 = v01 + new Vector3D(-EDGEWIDTH, 0, 0);
            Vector3D v10 = v02 + new Vector3D(0, -EDGEWIDTH, 0);
            Vector3D v11 = v03 + new Vector3D(0, EDGEWIDTH, 0);
            Vector3D v12 = v04 + new Vector3D(EDGEWIDTH, 0, 0);

            Triangle3D t1 = new Triangle3D(v05, v09, v02, EDGE_COLOR);
            Triangle3D t2 = new Triangle3D(v05, v02, v10, EDGE_COLOR);

            Triangle3D t3 = new Triangle3D(v10, v06, v04, EDGE_COLOR);
            Triangle3D t4 = new Triangle3D(v12, v06, v04, EDGE_COLOR);

            Triangle3D t5 = new Triangle3D(v12, v03, v08, EDGE_COLOR);
            Triangle3D t6 = new Triangle3D(v07, v03, v08, EDGE_COLOR);

            Triangle3D t7 = new Triangle3D(v11, v07, v09, EDGE_COLOR);
            Triangle3D t8 = new Triangle3D(v11, v01, v09, EDGE_COLOR);

            this.addTriangle(t1);
            this.addTriangle(t2);
            this.addTriangle(t3);
            this.addTriangle(t4);
            this.addTriangle(t5);
            this.addTriangle(t6);
            this.addTriangle(t7);
            this.addTriangle(t8);
        }
コード例 #3
0
ファイル: Diamond3D.cs プロジェクト: CedricHanebaum/Dame
        public Diamond3D(Vector3D basePoint)
            : base(basePoint)
        {
            Vector3D v1 = new Vector3D(5, 5, 0);
            Vector3D v2 = new Vector3D(-5, 5, 0);
            Vector3D v3 = new Vector3D(5, -5, 0);
            Vector3D v4 = new Vector3D(-5, -5, 0);

            Vector3D v5 = new Vector3D(0, 0, 8);
            Vector3D v6 = new Vector3D(0, 0, -8);

            Triangle3D t1 = new Triangle3D(v5, v1, v2, Color.Green);
            Triangle3D t2 = new Triangle3D(v6, v1, v2, Color.Green);

            Triangle3D t3 = new Triangle3D(v5, v1, v3, Color.DarkGreen);
            Triangle3D t4 = new Triangle3D(v6, v1, v3, Color.DarkGreen);

            this.addTriangle(t1);
            this.addTriangle(t2);
            this.addTriangle(t3);
            this.addTriangle(t4);
        }
コード例 #4
0
ファイル: Board3D.cs プロジェクト: CedricHanebaum/Dame
        private Triangle3D[] getRect(int x, int y, Color color)
        {
            Triangle3D[] ret = new Triangle3D[2];

            Vector3D v1 = new Vector3D(x, y, 0);
            Vector3D v2 = new Vector3D(x + RECTSIZE, y, 0);
            Vector3D v3 = new Vector3D(x, y + RECTSIZE, 0);
            Vector3D v4 = new Vector3D(x + RECTSIZE, y + RECTSIZE, 0);

            ret[0] = new Triangle3D(v1, v2, v3, color);
            ret[1] = new Triangle3D(v4, v2, v3, color);

            return ret;
        }
コード例 #5
0
ファイル: Shape.cs プロジェクト: CedricHanebaum/Dame
 protected void addTriangle(Triangle3D t)
 {
     triangleList.Add(t);
 }