vydd / sketch

A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
MIT License
1.39k stars 66 forks source link

Implement POLYGON using OpenGLU's tessellator. #141

Closed Gleefre closed 5 months ago

Gleefre commented 5 months ago

I finished @Kevinpgalligan's draft.

Further testing is required.

It might be needed to change the :winding-rule (for example from :odd to :nonzero).

Kevinpgalligan commented 5 months ago

I've confirmed that this fixes the test case I included here: https://github.com/vydd/sketch/issues/15#issuecomment-1444655202

Kevinpgalligan commented 5 months ago

Another test: each loop this sketch draws a new polygon with 10 random vertices.

(defsketch test-polygons
        ((width 100) (height 100))
      (apply #'polygon (loop repeat 20 collect (random width))))

It seems to run indefinitely, so it's pretty robust. And obviously works regardless of whether the polygon is self-intersecting.

vydd commented 5 months ago

implemented in #152