πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Sign inDemoInstall
Socket

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

0.1.9
Source
npm
Version published
Weekly downloads
0
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

point

FAQs

Package last updated on 31 Dec 2023

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