Module Beloch.Sheet

The sheet a program folds (def-sheet): the unfolded state it starts from and the outline of that state, in paper coordinates.

type side = Geom.point * Geom.point
type t = {
  1. start : Fold_state.t;
    (*

    the unfolded state the program starts from

    *)
  2. outline : side list;
    (*

    the sides of the sheet's boundary, counter-clockwise, paper space

    *)
  3. joins : int list;
    (*

    the creases whose flat hinges only divide the sheet into convex faces: no crease of the sheet, written as FOLD join edges

    *)
}
val square_corners : Num.t -> Geom.point array
val square : Num.t -> t
val on_boundary : t -> Geom.point -> Geom.point -> bool
val boundary_lines : t -> (Geom.line * side) list
val clip : t -> Geom.line -> side option
val point_at : side -> Num.t -> Geom.point
val sides_of : Geom.point array -> side list
val boundary_sides : Geom.point array list -> side list
val loops : side list -> side list list
val merge_convex : Geom.point array -> Geom.point array -> Geom.point array option
val restrict_mark : Geom.point array list -> Fold_state.mark -> Fold_state.mark option
val trim : Fold_state.t -> int list -> folded:(int -> bool) -> (t, [ `Hole ]) Stdlib.result