Skip to content

Add get_accessory_metrics for hip-anchored bag positioning#109

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-automatic-bag-positioning
Draft

Add get_accessory_metrics for hip-anchored bag positioning#109
Copilot wants to merge 2 commits intomainfrom
copilot/add-automatic-bag-positioning

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Implements automatic bag placement logic in Python (api/peacock_core.py), mirroring the positioning contract defined in robert-engine.ts. The function derives bag size from shoulder width (or canvas fallback) and positions it relative to the hip Y-anchor, with a fixed 88% opacity.

Changes

  • api/peacock_core.py

    • Added _ACCESSORY_ALPHA = 0.88 constant
    • Added get_accessory_metrics(img_ar, anchors, canvas_dim):
      • hasBody=Truebag_w = shoulderW × 0.8, bag_x = cx + shoulderW × 0.6
      • hasBody=Falsebag_w = canvas.w × 0.18, bag_x = cx + canvas.w × 0.12
      • bag_h = bag_w × img_ar, bag_y = hipY − bag_h × 0.3
  • tests/test_accessory_metrics.py — 14 new unit tests covering both body/no-body branches and edge cases (zero hip, square AR, alpha invariance)

metrics = get_accessory_metrics(
    img_ar=1.5,
    anchors={"cx": 320, "shoulderW": 200, "hipY": 400, "hasBody": True},
    canvas_dim={"w": 640, "h": 960},
)
# {"x": 440.0, "y": 346.0, "w": 160.0, "h": 240.0, "alpha": 0.88}

@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 automatic positioning for bags using HipY Add get_accessory_metrics for hip-anchored bag positioning Apr 7, 2026
Copilot AI requested a review from LVT-ENG April 7, 2026 13:38
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