Catalog npm
PACKAGE EXPLORERView in registry

2dv

npm

Very useful small class to perform vector calculations. Very practical as basis for all kinds of simulations and games where objects move through a two-dimensional space.

javascripttypescriptvectorvector math
Versions collected3
Direct dependencies3From release 1.0.3
Last observed20 Oct, 19:12 UTC

README

Current package documentation

2dv — Vector calculation package written in TypeScript

build npm

Very useful small class to perform vector calculations. Very practical as basis for all kinds of simulations and games where objects move through a two-dimensional space.

Get started

npm i 2dv

Use in your JavaScript/Typescript project

import { Vector } from '2dv';
// OR
const { Vector } = require('2dv');

const myVector = new Vector(10, 20);

myVector.add(100);
…

const newVector = Vector.add(myVector, 10);
…

Overview

Detailed documentation: https://wetterben.github.io/2dv/

Properties

  • x
  • y

Accessors

  • angle
  • length
  • magnitude
  • max
  • min

Methods

Instance

  • add
  • angleTo
  • clone
  • crossProduct
  • divide
  • dotProduct
  • equals
  • inverse
  • multiply
  • normalize
  • set
  • sub
  • toArray

Static

  • add
  • angleBetween
  • closestPointBetween
  • crossProduct
  • distance
  • divide
  • dotProduct
  • equals
  • fromArray
  • inverse
  • isOnLine
  • multiply
  • normalize
  • pointBetween
  • sub

Documentation

You can find a detailed documentation of all methods here: https://wetterben.github.io/2dv/

Roadmap

  • Automated tests
  • Visual Demo
  • More methods

Contribute

Feel free to add missing functions or fix things. Just do a PR.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 3

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.3Registry latest8 Jul 20203
1.0.28 Jul 20203
1.0.18 Jul 20203

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

MOVED
wetterben/vector2d

Shared repository data · GitHub

Repository moved · manual review pending

HTTP 301 · detected 20 Oct 2026

Reported destination
License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:12 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:67b9f70f782b677325d86d0d77643b0626cf000e8f6bd6ecbc39825dec705509