Example #1
0
        public Hexahedron(double size)
        {
            points = new List <XYZPoint>();

            points.Add(new XYZPoint(-size / 2, -size / 2, -size / 2));
            points.Add(new XYZPoint(-size / 2, -size / 2, size / 2));
            points.Add(new XYZPoint(-size / 2, size / 2, -size / 2));
            points.Add(new XYZPoint(size / 2, -size / 2, -size / 2));
            points.Add(new XYZPoint(-size / 2, size / 2, size / 2));
            points.Add(new XYZPoint(size / 2, -size / 2, size / 2));
            points.Add(new XYZPoint(size / 2, size / 2, -size / 2));
            points.Add(new XYZPoint(size / 2, size / 2, size / 2));

            Verges.Add(new Verge(new XYZPoint[] { points[0], points[1], points[5], points[3] }));
            Verges.Add(new Verge(new XYZPoint[] { points[2], points[6], points[3], points[0] }));
            Verges.Add(new Verge(new XYZPoint[] { points[4], points[1], points[0], points[2] }));
            Verges.Add(new Verge(new XYZPoint[] { points[7], points[5], points[3], points[6] }));
            Verges.Add(new Verge(new XYZPoint[] { points[2], points[4], points[7], points[6] }));
            Verges.Add(new Verge(new XYZPoint[] { points[4], points[1], points[5], points[7] }));
        }
Example #2
0
        public Tetrahedron(double size)
        {
            double h = Math.Sqrt(2.0 / 3.0) * size;

            points = new List <XYZPoint>();

            points.Add(new XYZPoint(-size / 2, 0, h / 3));
            points.Add(new XYZPoint(0, 0, -h * 2 / 3));
            points.Add(new XYZPoint(size / 2, 0, h / 3));
            points.Add(new XYZPoint(0, h, 0));

            // Основание тетраэдра
            Verges.Add(new Verge(new XYZPoint[] { points[0], points[1], points[2] }));
            // Левая грань
            Verges.Add(new Verge(new XYZPoint[] { points[1], points[3], points[0] }));
            // Правая грань
            Verges.Add(new Verge(new XYZPoint[] { points[2], points[3], points[1] }));
            // Передняя грань
            Verges.Add(new Verge(new XYZPoint[] { points[0], points[3], points[2] }));
        }
Example #3
0
        public Octahedron(double size)
        {
            points = new List <XYZPoint>();

            points.Add(new XYZPoint(-size / 2, 0, 0));
            points.Add(new XYZPoint(0, -size / 2, 0));
            points.Add(new XYZPoint(0, 0, -size / 2));
            points.Add(new XYZPoint(size / 2, 0, 0));
            points.Add(new XYZPoint(0, size / 2, 0));
            points.Add(new XYZPoint(0, 0, size / 2));


            Verges.Add(new Verge(new XYZPoint[] { points[0], points[2], points[4] }));
            Verges.Add(new Verge(new XYZPoint[] { points[2], points[4], points[3] }));
            Verges.Add(new Verge(new XYZPoint[] { points[4], points[5], points[3] }));
            Verges.Add(new Verge(new XYZPoint[] { points[0], points[5], points[4] }));
            Verges.Add(new Verge(new XYZPoint[] { points[0], points[5], points[1] }));
            Verges.Add(new Verge(new XYZPoint[] { points[5], points[3], points[1] }));
            Verges.Add(new Verge(new XYZPoint[] { points[0], points[2], points[1] }));
            Verges.Add(new Verge(new XYZPoint[] { points[2], points[1], points[3] }));
        }
Example #4
0
        public Icosahedron(double size)
        {
            // радиус описанной сферы
            double R = (size * Math.Sqrt(2.0 * (5.0 + Math.Sqrt(5.0)))) / 4;

            // радиус вписанной сферы
            double r = (size * Math.Sqrt(3.0) * (3.0 + Math.Sqrt(5.0))) / 12;

            points = new List <XYZPoint>();

            for (int i = 0; i < 5; ++i)
            {
                points.Add(new XYZPoint(
                               r * Math.Cos(2 * Math.PI / 5 * i),
                               R / 2,
                               r * Math.Sin(2 * Math.PI / 5 * i)));
                points.Add(new XYZPoint(
                               r * Math.Cos(2 * Math.PI / 5 * i + 2 * Math.PI / 10),
                               -R / 2,
                               r * Math.Sin(2 * Math.PI / 5 * i + 2 * Math.PI / 10)));
            }

            points.Add(new XYZPoint(0, R, 0));
            points.Add(new XYZPoint(0, -R, 0));

            // середина
            for (int i = 0; i < 10; ++i)
            {
                Verges.Add(new Verge(new XYZPoint[] { points[i], points[(i + 1) % 10], points[(i + 2) % 10] }));
            }

            for (int i = 0; i < 5; ++i)
            {
                // верхняя часть
                Verges.Add(new Verge(new XYZPoint[] { points[2 * i], points[10], points[(2 * (i + 1)) % 10] }));
                // нижняя часть
                Verges.Add(new Verge(new XYZPoint[] { points[2 * i + 1], points[11], points[(2 * (i + 1) + 1) % 10] }));
            }
        }