Socket
Socket
Sign inDemoInstall

vec3

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vec3

3d vector math with good unit tests


Version published
Weekly downloads
7.6K
increased by96.54%
Maintainers
2
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 07 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc