Frontline

This commit is contained in:
Tomas Richtar
2025-06-06 11:02:47 +02:00
parent 896754c48a
commit 355fdd0c09
7 changed files with 303 additions and 142 deletions

View File

@@ -4,7 +4,7 @@ import { getArrowPolygonEuclidean } from "athena-utils/shape/Arrow.js";
import { ARROW_BODY_STYLE_CONSTANT, ARROW_BODY_STYLE_LINEAR, ARROW_BODY_STYLE_EXPONENTIAL } from "athena-utils/shape/Arrow.js";
import { getCirclePolygonEuclidean } from "athena-utils/shape/BasicShapes.js";
import { getRectanglePolygonEuclidean } from "athena-utils/shape/BasicShapes.js";
import { getFrontline } from "athena-utils/shape/Frontline.js";
import { getFrontlineEuclidean } from "athena-utils/shape/Frontline.js";
import { LEFT_SIDE, RIGHT_SIDE, BOTH_SIDES } from "athena-utils/shape/Frontline.js";
// Polygon merge using Turf library
import {mergeTurfPolygons} from "athena-utils/shape/Polygon.js";
@@ -171,18 +171,18 @@ const mergedRectangle = mergeTurfPolygons(circlePolygon, circlePolygonB);
const rectanglePoly = getRectanglePolygonEuclidean(circleCenter, rectangleSideA, rectangleSideB, rectangleRotation*-1);
const rectangleToTurfPoly = toTurfPolygon(rectanglePoly);
const frontlinePolygonA = getFrontline(frontlineDataA);
const frontlinePolygonA = getFrontlineEuclidean(frontlineDataA);
let frontlinePolygonMergedA = toTurfPolygon(frontlinePolygonA.body);
const frontlinePolygonB = getFrontline(frontlineDataB, protrusionDataB);
const frontlinePolygonB = getFrontlineEuclidean(frontlineDataB, protrusionDataB);
let frontlinePolygonMergedB = mergeTurfPolygons(frontlinePolygonB.body,frontlinePolygonB.protrusions[0]);
for (let i = 1; i < frontlinePolygonB.protrusions.length; i++)
{
frontlinePolygonMergedB = addTurfPolygonToMerge(frontlinePolygonMergedB, frontlinePolygonB.protrusions[i]);
}
const frontlinePolygonC = getFrontline(frontlineDataC, protrusionDataC);
const frontlinePolygonC = getFrontlineEuclidean(frontlineDataC, protrusionDataC);
let frontlinePolygonMergedLeft = mergeTurfPolygons(frontlinePolygonC.bodyLeft, frontlinePolygonC.protrusionsLeft[0]);
for (let i = 1; i < frontlinePolygonC.protrusionsLeft.length; i++) {