npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jiricekcz/geometry.js

v1.0.0

Published

Object-oriented typescript library for analytic geometry

Readme

Geometry JS

Geometry JS is a JavaScript/TypeScript library for creating and manipulating 2D geometry objects.

Table of contents

Getting started

Install the library using npm:

npm install @jiricekcz/geometry-js

Import the library in your code:

import * as GeometryJS from '@jiricekcz/geometry-js';

Documentation

The API documentation is available at https://geometryjs.jiricekcz.dev/. For more indepth information, see the wiki.

Requirements

Geometry JS requires a JavaScript runtime with support for ES6. It is a zero-dependency TypeScript library, so it can be used in any JavaScript project (Node.js, React, Angular, Vue, etc.). For more information about requirements, see the wiki (Requirements).

Usage

After importing the library, getting started is easy.
First, we need to create the main Plane object. This object represents the 2D plane on which all geometry objects are created.

import * as GeometryJS from '@jiricekcz/geometry-js';

// Create the main Plane object
const plane = GeometryJS.createPlane();

After that, we can create some geometry objects. For example, let's create a value (variable) x and a readonly value y.

// Create a value (variable) x
const x = plane.createValue(1);

// Create a readonly value y
const y = plane.createReadonlyValue(2);

Now, we can create a point A with coordinates x and y.

// Create a point A with coordinates x and y
const A = plane.createPointFromTwoValues(x, y);

We can also create a point B with coordinates 3 and 4.

// Create a point B with coordinates 3 and 4
const B = plane.createPointFromCoordinates(3, 4);

Now, we can create a line l from points A and B.

// Create a line l from points A and B
const l = plane.createLineFromTwoPoints(A, B);

We can also create a point O at the origin of the plane.

// Create a point O at the origin of the plane
const O = plane.createPointFromCoordinates(0, 0);

Then we can construct a line perpendicular to AB through O.

// Create a line perpendicular to l through O
const perpendicular = plane.constructPerpendicularLineFromPoint(l, O);

With just this code, we have declaratively defined the geometry. If we change any property of any non-readonly object, the whole geometry will be recalculated.

The whole code with minimal comments:

import * as GeometryJS from '@jiricekcz/geometry-js';

const plane = GeometryJS.createPlane();

const x = plane.createValue(1);
const y = plane.createReadonlyValue(2);

const A = plane.createPointFromTwoValues(x, y);
const B = plane.createPointFromCoordinates(3, 4);

const l = plane.createLineFromTwoPoints(A, B);

const O = plane.createPointFromCoordinates(0, 0);

const perpendicular = plane.constructPerpendicularLineFromPoint(l, O);

Beacuse of the declarative nature and descriptive names of the functions, the code is very readable and easy to understand.