All Projects → catenda → intersection-wasm

catenda / intersection-wasm

Licence: MIT license
Mesh-Mesh and Triangle-Triangle Intersection tests based on the algorithm by Tomas Akenine-Möller

Programming Languages

rust
11053 projects
shell
77523 projects

Projects that are alternatives of or similar to intersection-wasm

TriangleMeshDistance
Header only, single file, simple and efficient C++11 library to compute the signed distance function (SDF) to a triangle mesh
Stars: ✭ 55 (+223.53%)
Mutual labels:  triangle, collision-detection, mesh
SmartTrafficIntersection
Another AI toy project, of a traffic intersection controlled by a Reinforcement Learning AI agent to optimize traffic flow in an intersection of vehicles or pedestrians
Stars: ✭ 30 (+76.47%)
Mutual labels:  collision, collision-detection, intersection
Darkmode.js
🌓 Add a dark-mode / night-mode to your website in a few seconds
Stars: ✭ 2,339 (+13658.82%)
Mutual labels:  npm-package, npm-module
Jsonexport
{} → 📄 it's easy to convert JSON to CSV
Stars: ✭ 208 (+1123.53%)
Mutual labels:  npm-package, npm-module
Ts ci
✅ Continuous integration setup for TypeScript projects via GitHub Actions.
Stars: ✭ 225 (+1223.53%)
Mutual labels:  npm-package, npm-module
Homebridge Wol
A Wake on Lan plugin for Homebridge
Stars: ✭ 150 (+782.35%)
Mutual labels:  npm-package, npm-module
Reactopt
A CLI React performance optimization tool that identifies potential unnecessary re-rendering
Stars: ✭ 1,975 (+11517.65%)
Mutual labels:  npm-package, npm-module
Eslint Plugin Eslint Comments
Additional ESLint rules for directive comments of ESLint.
Stars: ✭ 221 (+1200%)
Mutual labels:  npm-package, npm-module
Forge Node App
🛠📦🎉 Generate Node.js boilerplate with optional libraries & tools
Stars: ✭ 90 (+429.41%)
Mutual labels:  npm-package, npm-module
DAABBCC
Dynamic AABB Tree native extension with Branch and Bound Algorithm for Defold Engine
Stars: ✭ 42 (+147.06%)
Mutual labels:  collision, collision-detection
skeletor
3D skeleton extraction from meshes.
Stars: ✭ 115 (+576.47%)
Mutual labels:  mesh, meshes
React Ckeditor
CKEditor component for React with plugin and custom event listeners support
Stars: ✭ 124 (+629.41%)
Mutual labels:  npm-package, npm-module
Tplink Cloud Api
A node.js npm module to remotely control TP-Link smartplugs (HS100, HS110) and smartbulbs (LB100, LB110, LB120, LB130) using their cloud web service (no need to be on the same wifi/lan)
Stars: ✭ 96 (+464.71%)
Mutual labels:  npm-package, npm-module
Node Regedit
Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host
Stars: ✭ 178 (+947.06%)
Mutual labels:  npm-package, npm-module
Event Target Shim
An implementation of WHATWG EventTarget interface, plus few extensions.
Stars: ✭ 89 (+423.53%)
Mutual labels:  npm-package, npm-module
Abort Controller
An implementation of WHATWG AbortController interface.
Stars: ✭ 213 (+1152.94%)
Mutual labels:  npm-package, npm-module
Point2Mesh
Meshing Point Clouds with Predicted Intrinsic-Extrinsic Ratio Guidance (ECCV2020)
Stars: ✭ 61 (+258.82%)
Mutual labels:  mesh, mesh-processing
Webcam Easy
javascript access webcam stream and take photo
Stars: ✭ 79 (+364.71%)
Mutual labels:  npm-package, npm-module
Node Loadbalance
A collection of distilled load balancing engines
Stars: ✭ 79 (+364.71%)
Mutual labels:  npm-package, npm-module
Singlespotify
🎵 Create Spotify playlists based on one artist through the command line
Stars: ✭ 254 (+1394.12%)
Mutual labels:  npm-package, npm-module

intersection-wasm

Mesh-Mesh and Triangle-Triangle Intersection tests based on the algorithm by Tomas Akenine-Möller.[1]

Built with 🦀 Rust and 🕸 WebAssembly.

Build Status GitHub version npm version license

About

Mesh-Mesh and Triangle-Triangle Intersection tests.

/**
* Triangle/triangle intersection test
* @returns true if the triangles intersect, otherwise false
*/
const noDivTriTriIsect = (
  v0: [number, number, number],
  v1: [number, number, number],
  v2: [number, number, number],

  u0: [number, number, number],
  u1: [number, number, number],
  u2: [number, number, number],

  // not used by default
  epsilon?: number
): boolean => {...}

/**
* Mesh/mesh intersection test
* @returns true if the meshes intersect, otherwise false
*/
const meshMeshIsect => (
  // m1.length should be divisible by 9
  m1: ArrayLike<number>,
  // m2.length should be divisible by 9
  m2: ArrayLike<number>,
  // defaults to 0.000001
  epsilon?: number
): boolean => {...}

🚴 Usage

Installation

You will need a package manager, either npm (comes with node) or yarn.

You will also need a bundler, webpack or Rollup, configured for your project.

Then, in a terminal:

npm install intersection-wasm
# Or, yarn add intersection-wasm

Afterwards, import and use as follows:

import * as intersection from 'intersection-wasm';

intersection.noDivTriTriIsect(
  [0.848311, 0.71034, 0.799546],
  [0.921121, 0.519029, 0.950985],
  [0, 1.751, 0],

  [-0.5, 0.8755, 0.5],
  [0.5, 0.8755, 1.5],
  [0.5, 0.8755, 0.5]
); // ← false

intersection.meshMeshIsect(
  new Float32Array([
    -140.98574829101562,
    -173.12110900878906,
    -0.9740447998046875,
    -140.98574829101562,
    -174.72113037109375,
    -0.9740447998046875,
    -140.68576049804688,
    -174.72113037109375,
    -0.9740447998046875
  ]),
  new Float32Array([
    -140.98574829101562,
    -174.72113037109375,
    -0.9740447998046875,
    -140.98574829101562,
    -174.72113037109375,
    -0.9740447998046875,
    -140.98574829101562,
    -174.72113037109375,
    -1.137430191040039,
    -140.68576049804688,
    -174.72113037109375,
    -1.137430191040039,
    -140.98574829101562,
    -174.72113037109375,
    -0.9740447998046875,
    -140.68576049804688,
    -174.72113037109375,
    -1.137430191040039
  ]),
  0.0001
); // ← true

Development

🛠️ Build WASM

wasm-pack build

🛠️ Build natively

cargo build

🔬 Run tests in the browser

cd demo && npm i && npm start

🔬 Test natively

cargo test

🎁 Publish to NPM

wasm-pack publish
1. Möller, T. (1997). A fast triangle-triangle intersection test. Journal of graphics tools, 2(2), 25-30.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].