Skip to content

3d vector math with robust unit tests

Notifications You must be signed in to change notification settings

anonchan/node-vec3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vec3

NPM version Build Status

3D vector math with robust unit tests.

Usage

var v = require('vec3');

var v1 = v(1, 2, 3);
console.log(v1); // prints "(1, 2, 3)"
var v2 = v1.offset(0, 0, 1);
console.log(v2); // prints "(1, 2, 4)"

Or:

var Vec3 = require('vec3').Vec3;

var v1 = new Vec3(1, 2, 3);
// etc...

More available functions are listed below in Test Coverage.

Test Coverage

v()
    ✓ no args
    ✓ x, y, z
    ✓ array
    ✓ object
    ✓ string coords
    ✓ deserialize
    ✓ invalid deserialize

  vec3
    ✓ floored
    ✓ floor
    ✓ offset
    ✓ translate
    ✓ plus
    ✓ minus
    ✓ scaled
    ✓ abs
    ✓ distanceTo
    ✓ equals
    ✓ toString
    ✓ clone
    ✓ add
    ✓ subtract
    ✓ multiply
    ✓ divide
    ✓ set
    ✓ modulus
    ✓ volume
    ✓ min
    ✓ max
    ✓ update
    ✓ norm
    ✓ dot
    ✓ cross
    ✓ unit
    ✓ normalize
    ✓ scale
    ✓ xyDistanceTo
    ✓ xzDistanceTo
    ✓ yzDistanceTo
    ✓ innerProduct
    ✓ manhattanDistanceTo
    ✓ toArray


  39 passing

More functions welcome in the form of pull requests.

History

See History

About

3d vector math with robust unit tests

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%