Skip to content

Add robert_engine: calculate_elasticity_breathing and calculate_drape_wave#108

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-elasticity-and-drape-wave-functions
Draft

Add robert_engine: calculate_elasticity_breathing and calculate_drape_wave#108
Copilot wants to merge 2 commits intomainfrom
copilot/add-elasticity-and-drape-wave-functions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Implements the two fabric-physics simulation functions specified in robert-engine.test.ts: sinusoidal elastic "breathing" oscillation and per-point hem drape wave offsets.

New: api/robert_engine.py

Four module-level constants replace magic numbers:

Constant Value Role
BREATHING_FREQUENCY 0.0015 Human-rhythm oscillation (rad/ms)
ELASTICITY_AMPLITUDE_FACTOR 0.0005 elasticityPct → amplitude scaling
MAX_DRAPE_AMPLITUDE_PX 6.0 Max hem displacement (px)
DRAPE_WAVE_FREQUENCY 0.002 Drape wave frequency (rad/ms)
# Scale factor oscillating around 1.0 at breathing rhythm
calculate_elasticity_breathing({"elasticityPct": 80.0, ...}, timestamp=1000.0)
# → 1.0 + sin(1000 * 0.0015) * (80 * 0.0005)

# 8 hem wave offsets, each with independent phase, bounded by drapeCoefficient * 6 px
calculate_drape_wave({"drapeCoefficient": 0.5, ...}, timestamp=200.0, garment_w=300.0)
# → [sin(200*0.002 + i*(π/8)) * 3.0  for i in range(8)]

New: tests/test_robert_engine.py

11 unittest cases covering: identity at t=0, oscillation polarity, amplitude scaling, zero-coefficient boundary, phase distinctness, per-point amplitude bounds, and exact formula values against the exported constants.

@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:38pm

Request Review

Copilot AI changed the title [WIP] Add elasticity breathing and drape wave calculation functions Add robert_engine: calculate_elasticity_breathing and calculate_drape_wave Apr 7, 2026
Copilot AI requested a review from LVT-ENG April 7, 2026 13:39
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