Skip to content

feat: implement RobertEngine — Lafayette fabric physics core#107

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-lafayette-factor-calculation
Draft

feat: implement RobertEngine — Lafayette fabric physics core#107
Copilot wants to merge 2 commits intomainfrom
copilot/add-lafayette-factor-calculation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Adds the RobertEngine Python class implementing fabric physics for garment overlay rendering in the Lafayette mirror, computing render metrics purely from detected biometric volumetry (no user-input weight/height required).

New: api/robert_engine.py

  • calculate_lafayette_factor(fabric) — silhouette width amplification: 2.2 + (0.5 − drapeCoeff × 0.4)
  • calculate_gravity_stretch(fabric, torso_h) — height elongation from GSM weight, normalised to 50–400 range, capped at +15%
  • calculate_dynamic_alpha(fit_score, fabric, timestamp) — alpha 0.95 at perfect fit (≥95%), otherwise 0.85 ± sinusoidal breathing pulse, clamped to [0.65, 0.95]
  • get_render_metrics(fabric_key, shoulder_w, torso_h, fit_score) — main API combining the above into {width, height, alpha, is_shiny, is_scanning, patent_id}

Pilot fabric catalogue includes silk_haussmann, business_elite, velvet_marais, linen_bastille, jersey_opera.

Bug fix

Reference code used if not timestamp: which treats the valid timestamp 0.0 as missing, silently falling back to time.time(). Changed to if timestamp is None:.

# Before — broken for timestamp=0.0
if not timestamp:
    timestamp = time.time() * 1000

# After
if timestamp is None:
    timestamp = time.time() * 1000

New: tests/test_robert_engine.py

32 unit tests across 4 classes covering the fabric catalogue, each calculation method (boundary conditions, clamping, cross-fabric ordering), and the full get_render_metrics output including the exact values from the problem statement's reference example.

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

Request Review

Copilot AI changed the title [WIP] Add calculation for Lafayette silhouette factor feat: implement RobertEngine — Lafayette fabric physics core 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