drawim icon indicating copy to clipboard operation
drawim copied to clipboard

Error to fill non convex polygon in opengl

Open GabrielLasso opened this issue 3 years ago • 1 comments

Instead it fills the convex hull of the polygon

Example:

import drawim

proc draw() =
  background(220)
  fill(255,0,0)
  beginFilledShape()

  vertex(100, 100)
  vertex(300, 300)
  vertex(500, 100)
  vertex(300, 200)

  endFilledShape()

run(600, 400, draw)

Captura de tela de 2021-09-17 19-08-08

In js it works

GabrielLasso avatar Sep 17 '21 22:09 GabrielLasso

https://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml

This might work, and the code is clean. Saving here to study it later

GabrielLasso avatar Sep 18 '21 11:09 GabrielLasso