Skip to main content

validate_part

Function validate_part 

Source
pub fn validate_part(
    ring: &[[i64; 2]],
    config: &ProtocolConfig,
) -> Option<String>
Expand description

Validate a polygon part against the per-part on-chain rules.

Mirrors polygon.move’s per-part checks — the ones enforced by part() and validate_part_edges/is_convex_vertices. Compactness is deliberately NOT checked here because on-chain applies it only at the polygon boundary (validate_multipart_topology). Callers that need the full polygon validation must also invoke topology::validate_multipart_topology.

Checks (in order):

  1. At least 3 vertices
  2. At most max_vertices_per_part vertices
  3. Weakly convex
  4. All edges >= min_edge_length_squared