@szydlovski/geometry
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Geometry

Basic immutable utilities for working with 2d geometry - points, rectangles, lines, vectors and angles.

Usage

npm install @szydlovski/geometry
import { Point, Rectangle, Angle } from '@szydlovski/geometry';

const p1 = new Point(5,5);

const rect1 = Rectangle.fromOriginAndDimensions(
  new Point(0, -10),
  { width: 10, height: 10}
);
const rect2 = rect1.rotate(Angle.fromDegrees(-90), new Point(0,0));
const rect3 = rect1.translate(0, 10);

rect1.containsPoint(p1) // false
rect2.containsPoint(p1) // true
rect3.containsPoint(p1) // true

Readme

Keywords

none

Package Sidebar

Install

npm i @szydlovski/geometry

Weekly Downloads

4

Version

0.2.0

License

none

Unpacked Size

25.2 kB

Total Files

31

Last publish

Collaborators

  • szydlovski