Sampling utilities for generating origami fold tasks.
Stateless sampler that produces a folded paper trajectory summary.
| Name | Type | Default | Description |
|---|---|---|---|
max_fold_attempts |
int |
20 |
Maximum random fold-line attempts per fold step. |
max_paper_retries |
int |
10 |
Maximum retries at each step before moving on. |
Generates a folded paper task with up to
levelsuccessful folds.Parameters
Name Type Description levelintMaximum number of fold steps to attempt. Returns
Returns a dictionary with the following keys:
Key Type Description total_actionnp.ndarrayFlattened fold endpoints [x1, y1, x2, y2, ...]; shape(4 * actual_folds,).actual_foldsintNumber of successful folds. final_paperpaper.PaperFolded paper state after sampling.
from data.origami_sampler import OrigamiSampler
sampler = OrigamiSampler()
sample = sampler.sample(level=3)
print(sample["actual_folds"], sample["total_action"].shape)Expected output (example):
3 (12,)
actual_folds <= level.- If no fold succeeds,
total_actionis an empty array with shape(0,).