A JavaScript library for doing geometry.
See the codeGeometric.js is a JavaScript library for working with points, lines, polygons, and angles. It uses plain JavaScript arrays for geometry primitives, includes TypeScript declarations for editor autocomplete and type checking, and works in modern browsers and Node.js.
Documentation and interactive examples are on the Geometric.js website.
npm install geometric -S
import * as geometric from "geometric";
Geometric.js keeps geometry simple. A point is an [x, y] array, a line is an array of two points, and a polygon is an array of points.
import { pointTranslate, lineRotate, polygonScale } from "geometric";
const point = [0, 0];
const line = [
[0, 0],
[10, 10],
];
const polygon = [
[0, 0],
[10, 0],
[10, 10],
[0, 10],
];
const translated = pointTranslate(point, 90, 10);
const rotated = lineRotate(line, 90);
const scaled = polygonScale(polygon, 2);
There are no custom classes to instantiate and no special data structures to learn. The values you pass into Geometric.js are the same values you can serialize, inspect, and draw to SVG or Canvas.
pnpm install
pnpm test
The test suite builds the package, runs runtime tests, and checks the TypeScript declarations.
Overall
Maintained
Code review
npm
Latest release
Releases this year
6,585 followers · starred Jun 2026
1,698 followers · starred Jun 2026
45,440 followers · starred Jun 2026
3,028 followers · starred May 2022
A JavaScript library for doing geometry.
See the codeGeometric.js is a JavaScript library for working with points, lines, polygons, and angles. It uses plain JavaScript arrays for geometry primitives, includes TypeScript declarations for editor autocomplete and type checking, and works in modern browsers and Node.js.
Documentation and interactive examples are on the Geometric.js website.
npm install geometric -S
import * as geometric from "geometric";
Geometric.js keeps geometry simple. A point is an [x, y] array, a line is an array of two points, and a polygon is an array of points.
import { pointTranslate, lineRotate, polygonScale } from "geometric";
const point = [0, 0];
const line = [
[0, 0],
[10, 10],
];
const polygon = [
[0, 0],
[10, 0],
[10, 10],
[0, 10],
];
const translated = pointTranslate(point, 90, 10);
const rotated = lineRotate(line, 90);
const scaled = polygonScale(polygon, 2);
There are no custom classes to instantiate and no special data structures to learn. The values you pass into Geometric.js are the same values you can serialize, inspect, and draw to SVG or Canvas.
pnpm install
pnpm test
The test suite builds the package, runs runtime tests, and checks the TypeScript declarations.
Overall
Maintained
Code review
npm
Latest release
Releases this year
6,585 followers · starred Jun 2026
1,698 followers · starred Jun 2026
45,440 followers · starred Jun 2026
3,028 followers · starred May 2022