Exemple #1
0
        private float VolumePiramide(Piramide piramide)
        {
            float volume = 0; //объём пирамиды

            foreach (Triangle triangle in piramide.base_triangles)
            {
                volume += 1 / 3 * SquareTriangle(triangle) * piramide.z;
            }

            return(0);
        }
Exemple #2
0
        private void InitializePiramides(List <Triangle> p_triangles, List <PointF> p_points)
        {
            triangles.AddRange(p_triangles);
            all_points.AddRange(p_points);

            foreach (PointF point in all_points)
            {
                Piramide piramide = new Piramide();
                piramide.base_triangles = new List <Triangle>();
                piramide.vertex         = point;
                piramide.z = 1;
                foreach (Triangle triangle in triangles)
                {
                    if (triangle.point1 == point || triangle.point2 == point || triangle.point3 == point)
                    {
                        piramide.base_triangles.Add(triangle);
                    }
                }
                piramide.volume = VolumePiramide(piramide);
            }
        }