Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct hittesting based on the image shape of alternate sprites #25

Open
davidbau opened this issue Feb 2, 2014 · 0 comments
Open

Comments

@davidbau
Copy link
Member

davidbau commented Feb 2, 2014

jquery-turtle supports convex hull hit testing, but it only takes advantage of this for the default turtle shape. It should automatically compute the convex hull of an image loaded via the 'wear' command, and use it for "touches" and "enclosedby" tests. The fact that it does not do this has been noticed by high school students.

Doing correct hit testing requires three things:
(1) we need to inspect the image bits when an alternate image is loaded. Not too hard if we have access to the bits (via CORS). The moment to inspect an image is at finishSet, added in e072cd1
(2) when we don't have access to the bits (because it's offdomain without cross-origin sharing headers), we need make a proxy on pencilcode and bounce the request off, so we get access to the bits.
(3) finally we need to do the bit of computational geometry to make the convex hull and load it up. Before adding new code, see convexHull in the jquery-turtle code.

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

No branches or pull requests

1 participant