apicici / clipper-lua

Lua bindings for Angus Johnson's Clipper library
Boost Software License 1.0
4 stars 0 forks source link

Clipping execute does not properly. #2

Closed findux closed 1 year ago

findux commented 1 year ago

Hi. As seen in the picture, after the 59th line, I get an error like the one on the screen. Isn't that the correct usage? I am using Löve2D 11.3. execute issue

apicici commented 1 year ago

The error is caused one of the paths passed to the Clipper object is open, but the Execute call is given a Paths object as the solution parameter. According to the documentation:

when open paths are passed to a Clipper object, the user must use a PolyTree object as the solution parameter, otherwise an exception will be raised.

In this case a PolyTree object should be used to store the solution:

local ress = clipperLib.PolyTree()
cl:Execute(clipperLib.ctIntersection, ress)