A robotics team can project sampled tool positions onto the floor plane to compare the spread of two motion programs. A convex hull gives those samples a single outer boundary and an enclosed area. In SciPy, the attribute names can lead a report astray: for two-dimensional coordinates, hull.area gives the perimeter and hull.volume gives the enclosed area. The same fields have their familiar surface-area and volume meanings for three-dimensional input.

Start with a known rectangle

A 4-by-2-meter rectangle has a perimeter of 12 meters and an area of 8 square meters. An interior point at (1, 1) should leave both measurements unchanged. The rectangle's unequal dimensions also make it easy to spot a report that accidentally substitutes the bounding box width for the perimeter.

from math import isclose

from scipy.spatial import ConvexHull

points_m = [(0, 0), (4, 0), (4, 2), (0, 2), (1, 1)]

hull = ConvexHull(points_m)

perimeter_m = hull.area

enclosed_area_m2 = hull.volume

assert isclose(perimeter_m, 12.0)

assert isclose(enclosed_area_m2, 8.0)

assert set(hull.vertices) == {0, 1, 2, 3}

Running this fixture returned 12.0 and 8.0, with the four rectangle corners as hull vertices. SciPy documents counterclockwise vertex order for a 2D hull. For a plot, use the returned indices to look up points in the original sample array and repeat the first vertex at the end to close the boundary.

Make the measurement explicit in reports

Give the report independent fields for perimeter and area with units in their names. Record the coordinate frame and the plane used for the projection alongside those fields. A log may arrive in millimeters while the comparison report uses meters. Converting the coordinates before computing the hull keeps the length and area conversions consistent and gives the rectangle fixture a straightforward unit check.

Review the sample geometry before treating the metric as a comparison. A single bad point beyond a corner can pull the entire boundary outward. Adjacent sample groups separated by an unsampled strip can share one hull that encloses the strip. A trace along a straight line needs a separate handling rule because it has no full-dimensional planar hull. Keep the plotted samples with each run so a reviewer can see what drove the change in area.

SciPy calls Qhull to compute the hull. The Qhull manual describes the facet-area and volume summaries behind that computation. For a floor-plane report, the SciPy reference defines the mapping to the two Python attributes. Carry the 4-by-2-meter fixture into a regression check whenever the reporting code changes how it projects points or labels dimensions.

Sources

https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html

https://raw.githubusercontent.com/qhull/qhull/master/html/qh-optf.htm