convexify operation

Syntax

  • convexify()
  • convexify(maxLength)

Parameters

  1. maxLength—float
    Maximum length of the split line which splits concave polygons into subpolygons. If not provided, no limit is applied, i.e. all resulting polygons are convex.

Description

The convexify operation splits a concave polygon into a number of convex polygons. If a maxLength parameter is provided, only split lines shorter than this value are applied and one of the resulting polygons might still be concave.

Related

Examples

The initial shapes:

Initial shapes

Generated shapes:

attr maxLength = 1

Lot -->
	convexify(maxLength)
	comp(f) {all: SubShapes}
	
SubShapes -->
  case scope.sx >= maxLength && scope.sy >= 
                   maxLength : 
    color("#00ff00")
  else:
    color("#ff0000")
Generated shapes

In this topic