ScratchData LogoScratchData
Back to gtoal's profile

Triangle Dynamics 2.0 remix - filled triangles

GTgtoal•Created March 19, 2015
Triangle Dynamics 2.0 remix - filled triangles
6
4
159 views
View on Scratch

Instructions

Grab the corners and reshape the triangle. See http://scratch.mit.edu/discuss/topic/98866/ This works best where you are filling the triangle anyway - however there's a more efficient variation on this code for outlined or off-screen triangles at http://scratch.mit.edu/projects/53393388/

Description

Remixed from RPGuy's project to show an alternative (possibly cheaper) way of testing if a point is inside a triangle... It fills the triangle by drawing horizontal lines, and does the inclusion test on the fly by seeing if the point is on one of those lines. The code could be further optimized, this is a quick proof of concept. (Obviously you would remove most of the redundant pen code in a real project, it was just written this way for the demo.)

Project Details

Project ID53377926
CreatedMarch 19, 2015
Last ModifiedMarch 20, 2015
SharedMarch 19, 2015
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root