Skip to content

Commit

Permalink
Update toolkit.js
Browse files Browse the repository at this point in the history
remove extra whitespace
  • Loading branch information
whatwareweb authored Jul 29, 2024
1 parent 78cbdc2 commit 5247851
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/drawingToolkit/toolkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,34 @@ export const toolkit = {
if (boundary === "closed" && points.length > 3) {
points.pop();
};

var curve = nurbs({
points,
degree,
boundary
});

const pl = [];
const domain = curve.domain[0];
const range = domain[1] - domain[0];
const stepSize = range/steps;

let i = domain[0];
while (i <= domain[1]) {

const pt = curve.evaluate([], i);
pl.push(pt);

i += stepSize;
}

if (i !== domain[1]) {
const pt = curve.evaluate([], domain[1]);
pl.push(pt);
}

return pl;

function isClosed(polyline, epsilon = 1e-3) {
let start = polyline[0]
let end = polyline[polyline.length - 1]
Expand Down Expand Up @@ -124,12 +124,12 @@ export const toolkit = {
polylines.forEach(pl => {
const newPl = simplifyPolyline(pl, tolerance, hq)
while (pl.length > 0) pl.pop()

while (newPl.length > 0) {
pl.push(newPl.shift())
}
})

return polylines;
},
trim: trimPolylines,
Expand Down Expand Up @@ -221,13 +221,13 @@ export const toolkit = {
const [first, ...rest] = arguments;
if (!first) return [];
if (!rest) return first;

rest.forEach(pls => {
pls.forEach(pl => {
first.push(pl);
})
});

return first;
},
copy(obj) {
Expand Down

0 comments on commit 5247851

Please sign in to comment.