discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.

isValidPiece function

bool isValidPiece(
  1. List<Vector2> ring
)

Whether ring is a piece the engine stores (spec 08 D9; 07 D6's invariant, per piece): at least three vertices, simple and anticlockwise (isSimpleCcw), and, closed as the wall stores it, with a non-empty triangulation (triangulationFor: the very check the engine's planner makes on a generated region, so the app never generates one it refuses).

Implementation

bool isValidPiece(List<Vector2> ring) {
  if (ring.length < 3 || !isSimpleCcw(ring)) return false;
  final triangles = triangulationFor(
      EntityKind.polyline, polylinePayload(ring, closed: true));
  return triangles != null && triangles.isNotEmpty;
}