Give a computer a jagged outline — the silhouette of a country, a cartoon cloud, a game character's hitbox — and sooner or later it needs to fill that shape, light it, or collide something against it. Almost every one of those operations is easiest on triangles, so the shape has to be cut into them first.
Ear clipping is the oldest and most intuitive way to do that cutting. Look at the polygon's corners one at a time. If a corner's tip can be sliced off with a single straight cut — a triangle that stays entirely inside the shape and traps no other corner — that corner is called an ear. Snip it off, and you are left with a smaller polygon and one more triangle in your collection. Keep going.
There is nothing clever about any single step. The whole trick is a guarantee: no matter how twisted the polygon, you can never get stuck without an ear to snip. That guarantee is what turns "seems to work" into an actual algorithm.
Comments
Loading comments...