Documentation ¶
Overview ¶
Package paths provides tools for manipulating 2d paths consisting of line segments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Path ¶
type Path struct {
V []Vec2
}
A Path is a contiguous series of line segments, from the first point in the V slice to the last.
type Paths ¶
Paths is a set of paths, along with a view bounds.
func FromSVG ¶
FromSVG parses an SVG file, extracting paths. This provides only limited SVG parsing support, and will fail or produce incorrect results if the SVG file uses features that it doesn't understand.
func (*Paths) Clip ¶
Clip removes all line segments outside the given bounds. If a path crosses the bounds, it's broken into multiple paths.
func (*Paths) Simplify ¶
Simplify removes points from paths, with the guarantee that all removed points are within the given tolerance (distance) from the new path.
func (*Paths) Sort ¶
func (ps *Paths) Sort(cfg *SortConfig)
Sort reorders paths to reduce the amount of movement between the end of one path and the start of the next. This is intended to improve rendering time using a physical xy plotter. The reordering can be configured in a limited way.
type SortConfig ¶
type SortConfig struct { Split bool // ok to split continuous paths Reverse bool // ok to draw paths in the reverse direction }
SortConfig provides options for path sorting.