brownplt / code.pyret.org

Website for serving Pyret to folks.
Other
24 stars 44 forks source link

overlay adding unecessary pixels? #498

Closed schanzer closed 7 months ago

schanzer commented 7 months ago

The following program produces some interesting results:

include image
include color

# make a star, then make a transparent rectangle that's the same size
imgA = star(50, "solid", "black")
bg = rectangle(image-width(imgA), image-height(imgA), "solid", transparent)

"confirm same dimensions for star and bg"
image-width(imgA)
image-height(imgA)
image-width(bg)
image-height(bg)

"check dimensions of star overlayed on bg"
image-width(overlay(imgA, bg))
image-height(overlay(imgA, bg))
blerner commented 7 months ago

You're forgetting about pinholes, which are placed at the barycenter of that star, so that rotate(any angle, that star) rotates about its center. If you center-pinhole(imgA) and overlay that, you get your "expected" result.

schanzer commented 7 months ago

headdesk

Yup. You're right. I'm sorry.