Coder Social home page Coder Social logo

node-vec3's Introduction

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
    ✔ isZero
    ✔ at
    ✔ xz
    ✔ xy
    ✔ yz
    ✔ xzy
    ✔ rounded
    ✔ round
    ✔ floored
    ✔ floor
    ✔ offset
    ✔ translate
    ✔ plus
    ✔ minus
    ✔ scaled
    ✔ abs
    ✔ distanceTo
    ✔ distanceSquared
    ✔ 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

  50 passing (14ms)

More functions welcome in the form of pull requests.

History

See History

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.