Skip to content

Add get_drape_folds — vertical fold rendering engine (Python port of robert-engine.ts)#112

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-drape-folds-calculation
Draft

Add get_drape_folds — vertical fold rendering engine (Python port of robert-engine.ts)#112
Copilot wants to merge 2 commits intomainfrom
copilot/update-drape-folds-calculation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Ports the vertical fold simulation logic from robert-engine.ts into a new Python module api/robert_engine.py. The function computes per-fold position and opacity for fabric drape rendering, with sinusoidal animation driven by a timestamp.

Changes

api/robert_engine.py

  • Adds get_drape_folds(fabric, garment_w, gravity_h, now_ms) — selects 3 or 5 folds based on drapeCoefficient threshold (< 0.5), applies per-fold sinusoidal X offset for motion simulation, and derives alpha from the drape coefficient
  • Full docstring documenting required fabric['drapeCoefficient'] key and returned dict structure (x, width, height, alpha)

tests/test_robert_engine.py

  • 13 unit tests covering fold count at and around the 0.5 boundary, dimension ratios (8% width / 70% height), opacity formula across the coefficient range, X position formula against manual calculation, and sinusoidal variation with now_ms
fabric = {"drapeCoefficient": 0.7}
folds = get_drape_folds(fabric, garment_w=100.0, gravity_h=200.0, now_ms=0.0)
# → 5 folds, each with x, width=8.0, height=140.0, alpha=0.12

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tryonyou-pilot Error Error Apr 7, 2026 1:57pm

Request Review

Copilot AI changed the title [WIP] Update drape folds calculation for vertical positioning Add get_drape_folds — vertical fold rendering engine (Python port of robert-engine.ts) Apr 7, 2026
Copilot AI requested a review from LVT-ENG April 7, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants