Skip to content

Instantly share code, notes, and snippets.

View chris--young's full-sized avatar

Chris Young chris--young

  • Beverly Hills, California
View GitHub Profile
const _3d = {};
_3d.vector = (x = 0, y = 0, z = 0) => [x, y, z];
_3d.matrix = (v0, v1, v2) => _3d.vector(v0, v1, v2);
_3d.identity = _3d.matrix([1, 0, 0], [0, 1, 0], [0, 0, 1]);
_3d.scale = (v, s) => _3d.vector(v[0] * s, v[1] * s, v[2] * s);
_3d.sum = (v0, v1, v2) => _3d.vector(v0[0] + v1[0] + v2[0], v0[1] + v1[1] + v2[1], v0[2] + v1[2] + v2[2]);
_3d.transform = (v, m) => _3d.sum(_3d.scale(m[0], v[0]), _3d.scale(m[1], v[1]), _3d.scale(m[2], v[2]));
_3d.multiply = (m0, m1) => _3d.matrix(_3d.transform(m1[0], m0), _3d.transform(m1[1], m0), _3d.transform(m1[2], m0));
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>N-API | Node.js v4.6.0 Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
<link rel="canonical" href="https://nodejs.org/api/n-api.html">
</head>
@chris--young
chris--young / n-api.html
Last active September 15, 2017 17:08
pre
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>N-API | Node.js v4.6.0 Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
<link rel="canonical" href="https://nodejs.org/api/n-api.html">
</head>