lights FAQ Forum github.com/luapower/path2d

2D Geometry
path2d
affine2d
box2d
clipper

path2d

2D geometry in Lua


local path = require'path'

Fast, full-featured 2D geometry library written in Lua.
Includes construction, drawing, measuring, hit testing and editing of 2D paths.

Overview

  • modular, bottom-up style programming (procedural, no state, no objects)
  • no dynamic allocations on most operations
  • all features available under affine transformation, with fast code paths for special cases
  • full support for SVG path command set and semantics and more.

Status

See open issues.

Geometric types

Measuring

  • bounding box
  • length at time t
  • point at time t
  • arc length parametrization (NYI)

Hit testing

  • shortest distance from point
  • inside/outside testing for closed subpaths (NYI)

Drawing

  • simplification (decomposing into primitive operations)
  • adaptive interpolation of quad and cubic bezier curves
  • polygon offseting with different line join and line cap styles (NYI)
  • dash generation (NYI)
  • text-to-path (NYI)
  • conversion to cairo paths for drawing with cairo or with [sg_cairo]
  • conversion to OpenVG paths for drawing with the [openvg] API (NYI)

Editing

  • adding, removing and updating commands
  • splitting of lines, curves and arcs at time t
  • joining of lines, curves and arcs (NYI)
  • conversion between lines, curves, arcs and composite shapes (NYI).
  • direct manipulation [path editor][path2d_editor] with chained updates and constraints, making it easy to customize and extend to support new command types (WIP).

Last updated: 5 years ago | Edit on GitHub

Package:path2d
Pkg type:Lua+ffi
Version: 25f64fb
Last commit:
License: Public Domain

Requires: eq  glue  pp  luajit 

Required by: cplayer 


Top