Module Beloch.Collapse

Single-vertex collapse: fold along n >= 4 material crease segments sharing one interior endpoint O: the flat end state of a multi-crease move (rabbit ear hull2020, Thm 8.5). Skips the 3D intermediate entirely: checks the end state exists (Kawasaki and Maekawa where the anchor surrounds O, the closure of the paper paths everywhere), moves each face by the creases on its paper path (ADR 0044), enumerates valid layer orders.

type elem = {
  1. cid : int;
  2. ea : Geom.point;
  3. eb : Geom.point;
  4. valley : bool;
}
val e_no_vertex : string
val e_count : string
val e_midpaper : string
val e_kawasaki : string
val e_maekawa : string
val e_selfint : string
val e_contra : string
val e_dup_ray : string
val e_ambig : int -> string
val e_out_of_paper : string
val e_stayer_collinear : string
val e_stayer_dead : string
val e_unaligned : string
val e_anchor_stays : string
val e_staying_none : string
val e_staying_several : string
val e_staying_off_anchor : string
val hint_of : string -> string option
type stayer =
  1. | Arc of Geom.point * Geom.point
  2. | Faces of int list
  3. | Points of Geom.point list
exception Stayer_collinear
val cross : (Num.t * Num.t) -> (Num.t * Num.t) -> (Num.t * Num.t) -> Num.t
val common_vertex : elem list -> Geom.point option
val far_of : Geom.point -> elem -> Geom.point
val sort_ccw : Geom.point -> elem list -> (Geom.point * elem) list
val effective_valley : bool -> Isometry.t -> Isometry.t -> bool
val is_identity : Isometry.t -> bool
val closure_ok : Geom.point -> (Geom.point * 'a) array -> bool
val far_on_flap_boundary : Fold_state.t -> Geom.point -> elem -> bool
val interior_vertex : Fold_state.t -> int list -> Geom.point -> bool
val linear_extensions : int -> (int * int) list -> int array list
val sector_of_poly : Geom.point -> (Geom.point * 'a) array -> (Geom.point array * Isometry.t) -> int
val sector_of_poly_opt : Geom.point -> (Geom.point * 'a) array -> (Geom.point array * Isometry.t) -> int
val in_ccw_arc : Geom.point -> Geom.point -> Geom.point -> Geom.point -> bool
val in_closed_sector : Geom.point -> Geom.point -> Geom.point -> Geom.point -> bool
val rotate_rays : 'a array -> int -> 'a array
val admissible_sectors : stayer:stayer -> Geom.point -> (Geom.point * 'a) array -> int array -> int -> int list
val stayer_sectors : stayer:stayer -> anchor:bool array -> Geom.point -> (Geom.point * 'a) array -> int array -> int -> (int list, string) Stdlib.result
val anchor_faces : Fold_state.t -> Geom.point -> Geom.point array list option -> bool array
val surrounded : Fold_state.t -> Geom.point -> bool array -> bool
val rays_of : Geom.point -> elem list -> ((Geom.point * elem) array, string) Stdlib.result
val prepipeline_geom : ?anchor:Geom.point array list -> Fold_state.t -> elem list -> (Geom.point * (Geom.point * elem) array * bool, string) Stdlib.result
val maekawa_ok : bool list -> bool
type pipeline = {
  1. root : int;
  2. candidate_at : root:int -> base:Isometry3.t -> int array -> (Fold_state.t, Fold_state.violation) Stdlib.result;
  3. distinct : int array list;
}
type sector_geom = {
  1. sg_g : Fold_state.t;
  2. sg_faces : Geom.point array array;
  3. sg_nf : int;
  4. sg_nt : int;
  5. sg_motion : Isometry.t array;
  6. sg_unit : int array;
  7. sg_nu : int;
  8. sg_stat_cons : (int * int) list;
  9. sg_letters : (int * int * int * bool) list;
  10. sg_g_rank : int array;
  11. sg_root : int;
  12. sg_marks : Fold_state.mark array;
  13. sg_new_hinges : Fold_state.hinge array;
  14. mutable sg_overlaps : (int * int) list option;
}
val tip_of : Fold_state.t -> sec:int array -> anchor:bool array -> bool array
val tip_base : Fold_state.t -> sec:int array -> tip:bool array -> bool array
val stacking_units : Fold_state.t -> n:int -> sec:int array -> tip:bool array -> tip_unit:int array -> int array * int * (int * int) list
type role =
  1. | Keep
  2. | Fold
  3. | Try
val mk_sector_geoms : Fold_state.t -> o:Geom.point -> rays:(Geom.point * elem) array -> es:elem array -> faces:Geom.point array array -> nf:int -> anchor:bool array -> (sector_geom list, string) Stdlib.result
val pipeline_solve : sector_geom -> valley:bool array -> over:(int * int) list -> (pipeline, string) Stdlib.result
val hull_cache : (Fold_state.t * Geom.point array) option Stdlib.ref
val table_hull : Fold_state.t -> Geom.point array
val in_bounds : Geom.point array -> Fold_state.t -> bool
val anchor_realization : Fold_state.t -> root:int -> candidate_at: (root:int -> base:Isometry3.t -> int array -> (Fold_state.t, Fold_state.violation) Stdlib.result) -> int array -> (Fold_state.t, string) Stdlib.result
val pool_of_runs : [ `Err of string | `Run of (Fold_state.t, string) Stdlib.result list ] list -> (Fold_state.t list, string) Stdlib.result
val fan_setup : ?anchor:Geom.point array list -> Fold_state.t -> elem list -> stayer:stayer -> (Geom.point * (Geom.point * elem) array * bool * Fold_state.face array * int * bool array * int list, string) Stdlib.result
val runs_of_sector : Fold_state.t -> (sector_geom list, string) Stdlib.result -> valley:bool array -> over:(int * int) list -> [> `Err of string | `Run of (Fold_state.t, string) Stdlib.result list ] list
val collapse_runs : ?anchor:Geom.point array list -> Fold_state.t -> elem list -> over:(int * int) list -> stayer:stayer -> (Fold_state.t list, string) Stdlib.result
val collapse_all_patterns : ?anchor:Geom.point array list -> ?sectors:int list -> Fold_state.t -> elem list -> over:(int * int) list -> stayer:stayer -> patterns:bool list list -> (Fold_state.t list, string) Stdlib.result list
val tips : ?anchor:Geom.point array list -> Fold_state.t -> elem list -> stayer:stayer -> (int * bool array) list
val collapse : ?anchor:Geom.point array list -> Fold_state.t -> elem list -> over:(int * int) list -> stayer:stayer -> (Fold_state.t, string) Stdlib.result
val collapse_all : ?anchor:Geom.point array list -> Fold_state.t -> elem list -> over:(int * int) list -> stayer:stayer -> (Fold_state.t list, string) Stdlib.result