JSPM

triangle-triangle-intersection

0.0.022
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 470
  • Score
    100M100P100Q98858F
  • License CC0-1.0

return line segment representing the intersection between a pair of 3D triangles. based on Thomas Möller's algorithm.

Package Exports

  • triangle-triangle-intersection
  • triangle-triangle-intersection/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (triangle-triangle-intersection) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

triangle-triangle-intersection

Check if two triangles intersect.

If they intersect, returns the line segment of their intersection.

If not, returns null.

Based on Thomas Möller's algorithm

Installation

npm i triangle-triangle-intersection

Usage

var tti = require('triangle-triangle-intersection');

//each triangle is 3 pts [x,y,z]
var triangle1 = [[0,0,0],[1,0,0],[1,1,0]];
var triangle2 = [[0,0,1],[1,0,1],[1,1,-1]];

var intersection = tti(triangle1,triangle2);

console.log(intersection);

//returns line segment of intersection:
//[ [ 1, 0.5, 0 ], [ 0.5, 0.5, 0 ] ]

See Also

stonks