boxes-and-bubbles
boxes-and-bubbles copied to clipboard
Bounds function incorrect placement
I may not understand what it's supposed to do, or maybe it's a bug, but I can't seem to get them to position correctly. If I change the math a little bit from this:
box (w,thickness) inf restitution (cx, hExt+halfThick) (0,0) meta,
box (w,thickness) inf restitution (cx, -(hExt+halfThick)) (0,0) meta,
box (thickness,h) inf restitution (wExt+halfThick, cy) (0,0) meta,
box (thickness,h) inf restitution (-(wExt+halfThick), cy) (0,0) meta
To this:
box (w,thickness) inf restitution (cx, cy + (hExt+halfThick)) (0,0) meta,
box (w,thickness) inf restitution (cx, cy - (hExt+halfThick)) (0,0) meta,
box (thickness,h) inf restitution (cx + (wExt+halfThick), cy) (0,0) meta,
box (thickness,h) inf restitution (cx - (wExt+halfThick), cy) (0,0) meta
Then it behaves exactly as I expect.
https://github.com/jastice/boxes-and-bubbles/blob/master/src/BoxesAndBubbles.elm#L109-L112