@flatten-js/core
Version:
Javascript library for 2d geometry
24 lines (20 loc) • 738 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- ALl credits to Turf https://github.com/Turfjs/turf/blob/master/examples/es-modules/index.html -->
<title>ES Modules</title>
</head>
<body>
<svg id="stage" width="500" height="500"></svg>
<script type="module">
import {point, circle, segment} from "https://unpkg.com/@flatten-js/core?module";
// make some construction
let s1 = segment(10,10,200,200);
let s2 = segment(10,160,200,30);
let c = circle(point(200, 110), 50);
let ip = s1.intersect(s2);
document.getElementById("stage").innerHTML = s1.svg() + s2.svg() + c.svg() + ip[0].svg();
</script>
</body>
</html>