regl 三角形切片拟合二维圆
原文链接: regl 三角形切片拟合二维圆 这种做法相对而言比较低效, 最好是先根据顶点是否相邻做分割, 用并查分割出几个集合, 然后每次在这些集合中绘制, 这样会减少大量时间 import createREGL from "regl"; import { randomColor } from "../../utils"; import Delaunator from "delaunator"; export default () => { const regl = createREGL(); const points: [number, number][] = []; const height = 100; const step = 4; for (let r = 0; r <= height; r += step) { for (let x = 0; x <= r; x += 10) { const y = (r ** 2 - x ** 2) ** 0.5; points.push([x, y]); points.push([x, -y]); points.push([-x, y]); points.push([-x, -y]); } } console.log(points.length); console.time("delaunay"); const delaunay =