convexity

open fun convexity(convexity: Int): Shape2d


open val convexity: Int?

Imagine travelling in a straight line cutting through the shape. The convexity is the maximum number of times your will enter the shape. For square and circle, this is 1. For a convex shape with a hole, it is 2. For a shape with a single concave part, such as a banana, it is also 2.

NOTE. I am using the definition of convexity as started here : http://opencsg.org/#FAQ

This is different to that stated by some OpenSCAD documentation (which says that convexity counts each time the line enters AND exits a shape, i.e. twice as many as stated by OpenCSG). However, here we see an OpenSCAD definition which agrees with OpenCSG (very bottom of the page),

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion

The link above was updated on 26 June 2020 with the "correct" definition of 2 for a shape where the line's entry + exit count is 4. Previous to 26 June 2020 it stated the convexity was 4.

OpenSCAD doesn't include convexity on 2D shapes, however when a 2D shape is extruded, then OpenSCAD's extrusion module has a convexity parameter. I think it's better to define the convexity on the 2D shape, and then extrude doesn't need a convexity parameter.