Beispiel #1
0
        public static string GetStats(this IGeometry self)
        {
            var sb = new StringBuilder();

            sb.AppendLine($"Points per face {self.PointsPerFace}");
            sb.AppendLine($"Is PolyMesh {self.IsPolyMesh()}");
            sb.AppendLine($"Number of vertices {self.Vertices.Count}");
            sb.AppendLine($"Number of used vertices {self.UsedVertices().Count}");
            sb.AppendLine($"Number of indices {self.Indices.Count}");
            sb.AppendLine($"Number of faces  {self.GetFaces().Count}");
            sb.AppendLine($"Bounding box {self.BoundingBox()}");
            sb.AppendLine($"Averge vertex {self.Vertices.Average()}");
            // TODO: distance from ground plane (box extent)
            // TODO: closest distance to origin (from box extent)
            // TODO: standard deviation
            // TODO: scene analysis as well
            // TODO: number of distinct vertices
            // TODO: volume of bounding box
            // TODO: surface area of bounding box on ground plane
            // TODO: average vertex
            // TODO: average normal and average UV
            var tris = self.Triangles();

            sb.AppendLine($"Triangles {tris.Count}");
            // TODO: this did not return actual distinct triangles and it is slow!!!
            //sb.AppendLine($"Distinct triangles {tris.ToEnumerable().Distinct().Count()}");
            var smallArea = 0.00001;

            sb.AppendLine($"Triangles with small area {tris.CountWhere(tri => tri.Area < smallArea)}");
            return(sb.ToString());
        }