lights FAQ Forum   github.com/luapower/path2d

2D Graphics
path2d
affine2d
box2d
clipper
cairo
freetype
openvg
svg_parser
hpdf

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

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

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).

Help needed

Please see the list of open issues.


Last updated: 13 months ago | Edit on GitHub

Pkg type:Lua+ffi
Version: dev-29-g6cc5e48
Last commit:
License: PD
Requires: +eq  +glue  +pp  +vararg  +luajit 
Required by: cplayer  sg  winapi 

Top