svg

package
v0.0.0-...-73d8155 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MillimetersPerPixel = 0.26458333

Variables

This section is empty.

Functions

func Distance

func Distance(p1, p2 Point) float64

Types

type Line

type Line struct {
	Points []Point
}

func NewLine

func NewLine() Line

func (*Line) Add

func (l *Line) Add(x, y float64)

func (*Line) Length

func (l *Line) Length() int

func (Line) PathLength

func (l Line) PathLength() (pathLength float64)

type Lines

type Lines struct {
	Lines  []Line
	Height float64
	Width  float64
	Bounds [4]float64
}

func ParseSVG

func ParseSVG(fname string) (lines Lines, err error)

func (*Lines) Add

func (l *Lines) Add(line Line)

func (Lines) Animate

func (l Lines) Animate(fname string) (err error)

func (Lines) BestOrdering

func (l Lines) BestOrdering() (l2 Lines)

func (Lines) BoundingBox

func (l Lines) BoundingBox(x, y, w, h float64) (l2 Lines)

func (Lines) Consolidate

func (l Lines) Consolidate(joinFraction float64) (l2 Lines)

func (Lines) Copy

func (l Lines) Copy() (l2 Lines)

func (Lines) Draw

func (l Lines) Draw(fname string) (err error)

func (Lines) DrawStep

func (l Lines) DrawStep(step int, im0 ...image.Image) (im image.Image)

func (Lines) Normalize

func (l Lines) Normalize() (l2 Lines)

Normalize keeps aspect ratio but makes sure all coordinates are between 0 and 1

func (Lines) RemoveSmall

func (l Lines) RemoveSmall(fraction float64) (l2 Lines)

func (Lines) Simplify

func (l Lines) Simplify(percent float64) (l2 Lines)

Simplify points by some percentage using the https://en.wikipedia.org/wiki/Visvalingam%E2%80%93Whyatt_algorithm

func (Lines) ToGcode

func (l Lines) ToGcode() (gcode string)

type Point

type Point struct {
	X, Y float64
}

func NewPoint

func NewPoint(x, y float64) Point

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL