0.0.2 • Published 2 years ago
lineseg v0.0.2
lineseg
Cut a line segment into multiple segments of equal length. Born in maptalks.three
install
NPM
npm i lineseg
#or
yarn add lineseg
#or
pnpm i lineseg
CDN
<script
type="text/javascript"
src="https://unpkg.com/lineseg/dist/lineseg.js"
></script>
API
- lineSeg(line,options)
ESM
//ESM
import {
lineSeg
} from "lineseg";
const line = [
[x, y],
[x, y],
[x, y],
[x, y],
[x, y], ..........
];
const seg = lineSeg(line, {
segDistance: 100,// per seg length
isGeo: true //Is it geographical coordinates
})
nodejs
//nodejs
const {lineSeg} = require("lineseg");
const line = [
[x, y],
[x, y],
[x, y],
[x, y],
[x, y], ..........
];
const seg = lineSeg(line, {
segDistance: 100,// per seg length
isGeo: true //Is it geographical coordinates
})
CDN
<script
type="text/javascript"
src="https://unpkg.com/lineseg/dist/lineseg.js"
></script>
<script>
const line = [
[x, y],
[x, y],
[x, y],
[x, y],
[x, y], ..........
];
const segs = lineseg.lineSeg(line, { segDistance: 100 });
</script>
0.0.2
2 years ago