Baltor Get started

Gallery / Mesh algorithms

Polygon offset with miter, round or bevel joins

In your harnessMesh algorithmMIT

Grow or shrink a simple 2D polygon by a distance with miter, round or bevel joins, refusing offsets that would make it cross itself. Use it for outlines, margins, toolpaths and walls from floor plans.

Render of Polygon offset with miter, round or bevel joins
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Entry points
offset_polygon, build, main
Parameters
distance, join, arc_segments
Complexity
O(n^2) including the self-intersection check
Axes
+Y up, metres; 2D (x, y) maps to (x, 0, -y)

Limits. Offsets that make edges vanish or cross are refused rather than cleaned up (no splitting into several polygons). Holes are not handled; offset each ring separately with the opposite sign. Round joins are polylines of arc_segments chords per right angle.

Details

Kind
Mesh algorithm
Engine
Python 3.10 or later
Files
10 files, 171.5 KB
Licence
MIT
Declared effects
reads files, runs commands, writes files
Checked with
Godot 4.7.2, gl_compatibility, OpenGL 3 driver, Mesa llvmpipe under Xvfb
Checks
generator runs system python, generator runs verifier python, gltf strict structure, interpreters agree, example matches generator, godot headless gltf load, godot compatibility render
Techniques
Offset edge lines along outward normals, Miter, round and bevel joins, Segment intersection test for self-crossing
Tags
offset, polygon, buffer, 2d, toolpath, outline
Identity
library.supply.creative_originals.beffd11add42a3130ea65e52.416269675e68142a
Version
416269675e68142a2c5841b3e96ee3da130e46811672d9050ef5280064c7e5a4

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.