pyclipper.PyclipperOffset()
时间: 2024-01-23 17:02:43 浏览: 112
`pyclipper.PyclipperOffset()` is a class in the Pyclipper library that is used to create an instance of the offset algorithm. This class provides methods to add paths and prepare the offsetting operation. The `AddPath()` method adds a path to the list of paths to be offset, while the `Execute()` method performs the offset operation and returns the result. The `Clear()` method is used to clear the list of paths.
Example usage:
```
import pyclipper
co = pyclipper.PyclipperOffset()
co.AddPath([(0, 0), (0, 10), (10, 10), (10, 0)], pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)
co.Execute(2)
```
This code creates an instance of the `PyclipperOffset` class, adds a path to the list of paths to be offset, sets the join type to `JT_ROUND` and the end type to `ET_CLOSEDPOLYGON`, and performs an offset operation with a distance of 2. The result of the offset operation will be returned by the `Execute()` method.
阅读全文