Added extra logging to fog cut

This commit is contained in:
Mitchell McCaffrey 2021-01-25 13:38:37 +11:00
parent 1c143f5464
commit 00422a8113

View File

@ -3,6 +3,7 @@ import polygonClipping from "polygon-clipping";
import * as Vector2 from "./vector2";
import { toDegrees, omit } from "./shared";
import { logError } from "./logging";
const snappingThreshold = 1 / 5;
export function getBrushPositionForTool(
@ -251,6 +252,7 @@ export function drawActionsToShapes(actions, actionIndex) {
hole.map(({ x, y }) => [x, y])
);
let shapeGeom = [[shapePoints, ...shapeHoles]];
try {
const difference = polygonClipping.difference(shapeGeom, actionGeom);
const intersection = polygonClipping.intersection(
shapeGeom,
@ -258,6 +260,15 @@ export function drawActionsToShapes(actions, actionIndex) {
);
addPolygonDifferenceToShapes(shape, difference, cutShapes);
addPolygonIntersectionToShapes(shape, intersection, cutShapes);
} catch {
logError(
new Error(
`Unable to find segment for shapes ${JSON.stringify(
shape
)} and ${JSON.stringify(action)}`
)
);
}
}
shapesById = cutShapes;
}