CSG Convex Hulls


Try this test case to see most of the edge-cases of a convex hull:


    <brush points="200,200 200,200 150,100 100,200 110,110 200,100 210,190 100,100"/>
      

For brushes in CSG, you want to work with convex solids. You don't have to, but you really want to when you can. A nice authoring approach here is just let someoneone give you an un-ordered set of points and compute a convex hull. The algorithm I reinvented here is the "Jarvis March", I learned the name from this nice YouTube video, which also helped me find one bug in my implementation, and remove some of the redundant safety checks I was doing. To compute a convex hull with the Jarvis March:

Some notes on instabilities: