JSFiddle - React, Tailwind, and code Playground
by bbmv_
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<script src="js/app.js"></script>
</head>
<body>
<script type="importmap">
{
"imports": {
"three": "../https://cdn.jsdelivr.net/npm/three@0.155.0/build/three.module.js"
}
}
</script>
</body>
</html>
JavaScript
import * as THREE from "https://cdn.jsdelivr.net/npm/three@0.155.0/build/three.module.js";
const triangle = new THREE.Triangle(
new THREE.Vector3(-1.3380769038464273, 0, 0.7476431518552372),
new THREE.Vector3(-0.8359183615570835, 0, 1.24980169414458),
new THREE.Vector3(-0.7510810860933383, 0, 1.3346389696083252)
);
const point = new THREE.Vector3(-0.12865346697414404, 0, 7.090555843622173);
console.log('The point lies within the triangle:', triangle.containsPoint(point));