ScratchData LogoScratchData
Back to ChromeCat_test's profile

Polygon Filler (via decomposition)

CHChromeCat_test•Created May 2, 2021
Polygon Filler (via decomposition)
14
11
211 views
View on Scratch

Instructions

I fixed Gtoal's algorithm by adding the extra condition that for a triangle to be an ear it must not have a point in the triangle. To see the old version set use_point_test to 0. ---------------------------------------------------------------------- Generates random polygons, then tessellates them into triangles by following the perimeter and chipping off a triangle every time two successive lines form a convex shape. Concave corners are skipped, but eventually after a few passes round the perimeter, there are no concave corners left. Set fill to 0 to see the triangle decomposition. Set debug to 1 to slow it down so you can see what's happening!

Description

original project (Gtoal's): https://scratch.mit.edu/projects/53924334 Point in tri algorithm: https://scratch.mit.edu/projects/138016290/ ------------------ UPDATES: - Optimised algorithm by adding auxillary arrays to reduce redundant computations - 04/10: fixed bug by syncing code with the polygon decomposition code from 3D fun house

Project Details

Project ID524385317
CreatedMay 2, 2021
Last ModifiedOctober 6, 2023
SharedMay 2, 2021
Visibilityvisible
CommentsAllowed