g.js — graphical objects for JavaScript

Geometry

Mathematical operations with points.

Creating points

makePoint — make a point based on X/Y values.

Calculations on points

angle — calculate an angle between two points.

coordinates — calculate a point based on another point.

distance — calculate the distance between two points.

reflect — reflect a point over an axis.

Geometric queries

bounds — give the bounds of the shape.

centroid — calculate the geometric center of the shape.

Shape to points

scatter — scatter points within a shape.

toPoints — give the points that make up a shape.

resample — calculate new points on the shape.

pointOnPath — calculate a point on a path.