npm install github:MarquisNecrosis/SVGArea#main
Můžete použít tuto stránku k vyzkoušení algoritmů.
Tento algoritmus spočítá plochu sloučených polygonů a umí také vytvořit výsledný sloučený polygon.
import { polygonIntersectionInSvg } from "svg-area-intersection"; polygonIntersectionInSvg(svgID, {show, redraw, color, opacity})
Kde parametry znamenají:
Tento algoritmus prostě spočítá všechny pixely uvnitř polygonů. Je naivní a neefektivní.
import { lazyStupidAreaCalculation } from "svg-area-intersection/heuristic"; lazyStupidAreaCalculation(svgID)
import { areaInSvgWithIntersection } from "svg-area-intersection/heuristic"; areaInSvgWithIntersection(svgID, numberOfRandomPoints)