vec3-rs
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Vec3-rs

NPM version

3D vector math with Rust backend

Installation

  • Via NPM:
npm install vec3-rs

Building

  • Via NAPI-RS:
npm install -g @napi-rs/cli

git clone https://github.com/firejoust/node-vec3-rs.git

cd node-vec3-rs

napi build --platform --release # this will generate index.js and index.d.ts

Usage

const Vec3 = require('vec3-rs');

let v1 = new Vec3(1, 2, 3)
console.log(v1) // prints "(1, 2, 3)"
let v2 = v1.offset(0, 0, 1)
console.log(v2) // prints "(1, 2, 4)"

Or:

const { Vec3 } = require('vec3-rs');

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

More available functions are listed below:

API

  Vec3
    ✓ rounded
    ✓ round
    ✓ 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

Readme

Keywords

none

Package Sidebar

Install

npm i vec3-rs

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

10.6 kB

Total Files

7

Last publish

Collaborators

  • firejoust