boxes-and-bubbles icon indicating copy to clipboard operation
boxes-and-bubbles copied to clipboard

Bounds function incorrect placement

Open greim opened this issue 8 years ago • 0 comments

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

greim avatar Feb 03 '17 00:02 greim