Statistics

We provide an interface for computing statistics of a triangulation using statistics. (If it is important to you, note that the methods used for computing these statistics do not use adaptive floating point arithmetic unfortunately.)

DelaunayTriangulation.IndividualTriangleStatisticsType
IndividualTriangleStatistics{T}

Statistics for a single triangle.

Fields

  • area: The area of the triangle.
  • lengths: The sorted lengths of the edges of the triangle.
  • circumcenter: The circumcenter of the triangle.
  • circumradius: The circumradius of the triangle.
  • angles: The sorted angles of the triangle.
  • radius_edge_ratio: The radius-edge ratio of the triangle.
  • edge_midpoints: The midpoints of the edges of the triangle.
  • aspect_ratio: The aspect ratio of the triangle.
  • inradius: The inradius of the triangle.
  • perimeter: The perimeter of the triangle.
  • centroid: The centroid of the triangle.
DelaunayTriangulation.TriangulationStatisticsType
TriangulationStatistics{T,V,I}

Statistics for a triangulation.

The constructor for this is statistics(tri::Triangulation).

Fields

  • num_vertices: The number of vertices in the triangulation.
  • num_solid_vertices: The number of solid vertices in the triangulation.
  • num_ghost_vertices: The number of ghost vertices in the triangulation.
  • num_edges: The number of edges in the triangulation.
  • num_solid_edges: The number of solid edges in the triangulation.
  • num_ghost_edges: The number of ghost edges in the triangulation.
  • num_triangles: The number of triangles in the triangulation.
  • num_solid_triangles: The number of solid triangles in the triangulation.
  • num_ghost_triangles: The number of ghost triangles in the triangulation.
  • num_constrained_boundary_edges: The number of constrained boundary edges in the triangulation.
  • num_constrained_interior_edges: The number of constrained interior edges in the triangulation.
  • num_constrained_edges: The number of constrained edges in the triangulation.
  • num_convex_hull_points: The number of points on the convex hull of the triangulation.
  • smallest_angle: The smallest angle in the triangulation.
  • largest_angle: The largest angle in the triangulation.
  • smallest_area: The smallest area in the triangulation.
  • largest_area: The largest area in the triangulation.
  • smallest_radius_edge_ratio: The smallest radius-edge ratio in the triangulation.
  • largest_radius_edge_ratio: The largest radius-edge ratio in the triangulation.
  • total_area: The total area of the triangulation.
  • individual_statistics: A dictionary mapping triangles to their individual statistics.

For example:

p1 = (0.0, 0.0)
p2 = (1.0, 0.0)
p3 = (1.0, 1.0)
p4 = (0.0, 1.0)
pts = [p1, p2, p3, p4]
tri = triangulate(pts)
julia> stats = statistics(tri)
Delaunay Triangulation Statistics.
   Triangulation area: 1.0
   Number of vertices: 5
   Number of solid vertices: 4
   Number of ghost vertices: 1
   Number of edges: 9
   Number of solid edges: 5
   Number of ghost edges: 4
   Number of triangles: 2
   Number of solid triangles: 2
   Number of ghost triangles: 0
   Number of constrained boundary edges: 0
   Number of constrained interior edges: 0
   Number of constrained edges: 0
   Number of convex hull points: 4
   Smallest angle: 45.0°
   Largest angle: 90.0°
   Smallest area: 0.5
   Largest area: 0.5
   Smallest radius-edge ratio: 0.7071067811865476
   Largest radius-edge ratio: 0.7071067811865476
stats = refine!(tri, max_area = 1e-2) # refine! computes and returns stats = statistics(tri) post-refinement
julia> stats
Delaunay Triangulation Statistics.
   Triangulation area: 0.9999999999999999
   Number of vertices: 98
   Number of solid vertices: 97
   Number of ghost vertices: 1
   Number of edges: 288
   Number of solid edges: 256
   Number of ghost edges: 32
   Number of triangles: 160
   Number of solid triangles: 160
   Number of ghost triangles: 0
   Number of constrained boundary edges: 0
   Number of constrained interior edges: 0
   Number of constrained edges: 0
   Number of convex hull points: 32
   Smallest angle: 30.231153476251915°
   Largest angle: 113.40705209438516°
   Smallest area: 0.0038884849847605116
   Largest area: 0.0098765990101033
   Smallest radius-edge ratio: 0.5799214659156856
   Largest radius-edge ratio: 0.9930687672569417

All the relevant docstrings for working with these structs are below.

DelaunayTriangulation.get_all_statFunction
get_all_stat(stats::TriangulationStatistics, stat::Symbol)

Returns all of the values of the statistic stat for all triangles in the triangulation statistics stats. The possible values for stat come from IndividualTriangleStatistics, namely:

  • area
  • lengths
  • circumcenter
  • circumradius
  • angles
  • radius_edge_ratio
  • edge_midpoints
  • aspect_ratio
  • inradius
  • perimeter
  • centroid
DelaunayTriangulation.get_areaMethod
get_area(stats::TriangulationStatistics, T)

Returns the area field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_lengthsMethod
get_lengths(stats::TriangulationStatistics, T)

Returns the lengths field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_circumcenterMethod
get_circumcenter(stats::TriangulationStatistics, T)

Returns the circumcenter field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_circumradiusMethod
get_circumradius(stats::TriangulationStatistics, T)

Returns the circumradius field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_anglesMethod
get_angles(stats::TriangulationStatistics, T)

Returns the angles field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_radius_edge_ratioMethod
get_radius_edge_ratio(stats::TriangulationStatistics, T)

Returns the radiusedgeratio field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_edge_midpointsMethod
get_edge_midpoints(stats::TriangulationStatistics, T)

Returns the edge_midpoints field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_aspect_ratioMethod
get_aspect_ratio(stats::TriangulationStatistics, T)

Returns the aspect_ratio field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_inradiusMethod
get_inradius(stats::TriangulationStatistics, T)

Returns the inradius field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_perimeterMethod
get_perimeter(stats::TriangulationStatistics, T)

Returns the perimeter field from the individual triangle statistics for the triangle T in the triangulation statistics stats.

DelaunayTriangulation.get_centroidMethod
get_centroid(stats::TriangulationStatistics, T)

Returns the centroid field from the individual triangle statistics for the triangle T in the triangulation statistics stats.