@cornerstonejs/tools 1.50.3 → 1.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/eventListeners/annotations/annotationCompletedListener.d.ts +2 -0
- package/dist/cjs/eventListeners/annotations/annotationCompletedListener.js +35 -0
- package/dist/cjs/eventListeners/annotations/annotationCompletedListener.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +2 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +174 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.d.ts +1 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.js +9 -0
- package/dist/cjs/eventListeners/annotations/contourSegmentation/index.js.map +1 -0
- package/dist/cjs/eventListeners/annotations/index.d.ts +2 -1
- package/dist/cjs/eventListeners/annotations/index.js +3 -1
- package/dist/cjs/eventListeners/annotations/index.js.map +1 -1
- package/dist/cjs/eventListeners/index.d.ts +2 -2
- package/dist/cjs/eventListeners/index.js +2 -1
- package/dist/cjs/eventListeners/index.js.map +1 -1
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts +3 -0
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +89 -0
- package/dist/cjs/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -0
- package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js +5 -53
- package/dist/cjs/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
- package/dist/cjs/init.js +2 -0
- package/dist/cjs/init.js.map +1 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.d.ts +3 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.js +21 -1
- package/dist/cjs/stateManagement/annotation/helpers/state.js.map +1 -1
- package/dist/cjs/store/ToolGroupManager/ToolGroup.d.ts +1 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js +3 -0
- package/dist/cjs/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/cjs/store/addTool.d.ts +1 -0
- package/dist/cjs/store/addTool.js +6 -1
- package/dist/cjs/store/addTool.js.map +1 -1
- package/dist/cjs/store/index.d.ts +2 -2
- package/dist/cjs/store/index.js +2 -1
- package/dist/cjs/store/index.js.map +1 -1
- package/dist/cjs/store/removeEnabledElement.js +1 -2
- package/dist/cjs/store/removeEnabledElement.js.map +1 -1
- package/dist/cjs/tools/AdvancedMagnifyTool.js +3 -10
- package/dist/cjs/tools/AdvancedMagnifyTool.js.map +1 -1
- package/dist/cjs/tools/annotation/AngleTool.js +5 -18
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js +9 -28
- package/dist/cjs/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/cjs/tools/annotation/BidirectionalTool.js +7 -22
- package/dist/cjs/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.js +7 -22
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/CobbAngleTool.js +5 -18
- package/dist/cjs/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +7 -22
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/KeyImageTool.js +5 -12
- package/dist/cjs/tools/annotation/KeyImageTool.js.map +1 -1
- package/dist/cjs/tools/annotation/LengthTool.js +5 -18
- package/dist/cjs/tools/annotation/LengthTool.js.map +1 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.d.ts +4 -1
- package/dist/cjs/tools/annotation/LivewireContourTool.js +30 -22
- package/dist/cjs/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +2 -1
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js +11 -0
- package/dist/cjs/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.d.ts +2 -10
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +6 -22
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.js +8 -23
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +8 -22
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/SplineROITool.d.ts +8 -9
- package/dist/cjs/tools/annotation/SplineROITool.js +27 -10
- package/dist/cjs/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/UltrasoundDirectionalTool.js +5 -18
- package/dist/cjs/tools/annotation/UltrasoundDirectionalTool.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +7 -6
- package/dist/cjs/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js +8 -5
- package/dist/cjs/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.js +8 -8
- package/dist/cjs/tools/annotation/planarFreehandROITool/editLoopCommon.js.map +1 -1
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js +6 -5
- package/dist/cjs/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/cjs/tools/base/ContourBaseTool.d.ts +2 -8
- package/dist/cjs/tools/base/ContourBaseTool.js.map +1 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.d.ts +3 -2
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js +13 -1
- package/dist/cjs/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js +3 -9
- package/dist/cjs/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
- package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js +3 -9
- package/dist/cjs/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
- package/dist/cjs/types/AnnotationRenderContext.d.ts +11 -0
- package/dist/cjs/types/AnnotationRenderContext.js +3 -0
- package/dist/cjs/types/AnnotationRenderContext.js.map +1 -0
- package/dist/cjs/types/IToolGroup.d.ts +2 -1
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.js +12 -0
- package/dist/cjs/utilities/contourSegmentation/areSameSegment.js.map +1 -0
- package/dist/cjs/utilities/contourSegmentation/index.d.ts +2 -0
- package/dist/cjs/utilities/contourSegmentation/index.js +11 -0
- package/dist/cjs/utilities/contourSegmentation/index.js.map +1 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts +3 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.js +8 -0
- package/dist/cjs/utilities/contourSegmentation/isContourSegmentationAnnotation.js.map +1 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.d.ts +2 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.js +19 -0
- package/dist/cjs/utilities/contours/areCoplanarContours.js.map +1 -0
- package/dist/cjs/utilities/contours/index.d.ts +2 -1
- package/dist/cjs/utilities/contours/index.js +3 -1
- package/dist/cjs/utilities/contours/index.js.map +1 -1
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.js +3 -22
- package/dist/cjs/utilities/contours/reverseIfAntiClockwise.js.map +1 -1
- package/dist/cjs/utilities/math/aabb/index.d.ts +1 -0
- package/dist/cjs/utilities/math/aabb/index.js +3 -1
- package/dist/cjs/utilities/math/aabb/index.js.map +1 -1
- package/dist/cjs/utilities/math/aabb/intersectAABB.d.ts +2 -0
- package/dist/cjs/utilities/math/aabb/intersectAABB.js +10 -0
- package/dist/cjs/utilities/math/aabb/intersectAABB.js.map +1 -0
- package/dist/cjs/utilities/math/point/distanceToPointSquared.js +4 -1
- package/dist/cjs/utilities/math/point/distanceToPointSquared.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.js +59 -0
- package/dist/cjs/utilities/math/polyline/areLineSegmentsIntersecting.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.d.ts +4 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.js +213 -0
- package/dist/cjs/utilities/math/polyline/combinePolyline.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.js +36 -0
- package/dist/cjs/utilities/math/polyline/containsPoint.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getAABB.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getAABB.js +18 -0
- package/dist/cjs/utilities/math/polyline/getAABB.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getArea.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/{calculateAreaOfPoints.js → getArea.js} +3 -3
- package/dist/cjs/utilities/math/polyline/getArea.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts +5 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.js +51 -0
- package/dist/cjs/utilities/math/polyline/getClosestLineSegmentIntersection.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js +28 -0
- package/dist/cjs/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +20 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js +22 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js +21 -0
- package/dist/cjs/utilities/math/polyline/getLineSegmentsIntersection.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.js +12 -0
- package/dist/cjs/utilities/math/polyline/getNormal2.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.js +29 -0
- package/dist/cjs/utilities/math/polyline/getNormal3.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.js +20 -0
- package/dist/cjs/utilities/math/polyline/getSignedArea.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/index.d.ts +14 -3
- package/dist/cjs/utilities/math/polyline/index.js +28 -6
- package/dist/cjs/utilities/math/polyline/index.js.map +1 -1
- package/dist/cjs/utilities/math/polyline/intersectPolyline.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/intersectPolyline.js +20 -0
- package/dist/cjs/utilities/math/polyline/intersectPolyline.js.map +1 -0
- package/dist/cjs/utilities/math/polyline/isClosed.d.ts +2 -0
- package/dist/cjs/utilities/math/polyline/isClosed.js +39 -0
- package/dist/cjs/utilities/math/polyline/isClosed.js.map +1 -0
- package/dist/esm/eventListeners/annotations/annotationCompletedListener.js +9 -0
- package/dist/esm/eventListeners/annotations/annotationCompletedListener.js.map +1 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js +153 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.js.map +1 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/index.js +2 -0
- package/dist/esm/eventListeners/annotations/contourSegmentation/index.js.map +1 -0
- package/dist/esm/eventListeners/annotations/index.js +2 -1
- package/dist/esm/eventListeners/annotations/index.js.map +1 -1
- package/dist/esm/eventListeners/index.js +2 -2
- package/dist/esm/eventListeners/index.js.map +1 -1
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js +61 -0
- package/dist/esm/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.js.map +1 -0
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js +5 -53
- package/dist/esm/eventListeners/segmentation/segmentationDataModifiedEventListener.js.map +1 -1
- package/dist/esm/init.js +3 -1
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/stateManagement/annotation/helpers/state.js +19 -1
- package/dist/esm/stateManagement/annotation/helpers/state.js.map +1 -1
- package/dist/esm/store/ToolGroupManager/ToolGroup.js +3 -0
- package/dist/esm/store/ToolGroupManager/ToolGroup.js.map +1 -1
- package/dist/esm/store/addTool.js +4 -0
- package/dist/esm/store/addTool.js.map +1 -1
- package/dist/esm/store/index.js +2 -2
- package/dist/esm/store/index.js.map +1 -1
- package/dist/esm/store/removeEnabledElement.js +1 -2
- package/dist/esm/store/removeEnabledElement.js.map +1 -1
- package/dist/esm/tools/AdvancedMagnifyTool.js +4 -11
- package/dist/esm/tools/AdvancedMagnifyTool.js.map +1 -1
- package/dist/esm/tools/annotation/AngleTool.js +6 -19
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js +10 -29
- package/dist/esm/tools/annotation/ArrowAnnotateTool.js.map +1 -1
- package/dist/esm/tools/annotation/BidirectionalTool.js +8 -23
- package/dist/esm/tools/annotation/BidirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.js +8 -23
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/CobbAngleTool.js +6 -19
- package/dist/esm/tools/annotation/CobbAngleTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +8 -23
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/KeyImageTool.js +6 -13
- package/dist/esm/tools/annotation/KeyImageTool.js.map +1 -1
- package/dist/esm/tools/annotation/LengthTool.js +6 -19
- package/dist/esm/tools/annotation/LengthTool.js.map +1 -1
- package/dist/esm/tools/annotation/LivewireContourTool.js +31 -23
- package/dist/esm/tools/annotation/LivewireContourTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js +11 -0
- package/dist/esm/tools/annotation/PlanarFreehandContourSegmentationTool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +7 -23
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js +9 -24
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +9 -23
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/SplineROITool.js +26 -9
- package/dist/esm/tools/annotation/SplineROITool.js.map +1 -1
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js +6 -19
- package/dist/esm/tools/annotation/UltrasoundDirectionalTool.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js +7 -6
- package/dist/esm/tools/annotation/planarFreehandROITool/closedContourEditLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js +8 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/drawLoop.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.js +8 -8
- package/dist/esm/tools/annotation/planarFreehandROITool/editLoopCommon.js.map +1 -1
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js +6 -5
- package/dist/esm/tools/annotation/planarFreehandROITool/openContourEditLoop.js.map +1 -1
- package/dist/esm/tools/base/ContourBaseTool.js.map +1 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js +13 -1
- package/dist/esm/tools/base/ContourSegmentationBaseTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js +4 -10
- package/dist/esm/tools/segmentation/RectangleROIStartEndThresholdTool.js.map +1 -1
- package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js +4 -10
- package/dist/esm/tools/segmentation/RectangleROIThresholdTool.js.map +1 -1
- package/dist/esm/types/AnnotationRenderContext.js +2 -0
- package/dist/esm/types/AnnotationRenderContext.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/areSameSegment.js +9 -0
- package/dist/esm/utilities/contourSegmentation/areSameSegment.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/index.js +3 -0
- package/dist/esm/utilities/contourSegmentation/index.js.map +1 -0
- package/dist/esm/utilities/contourSegmentation/isContourSegmentationAnnotation.js +4 -0
- package/dist/esm/utilities/contourSegmentation/isContourSegmentationAnnotation.js.map +1 -0
- package/dist/esm/utilities/contours/areCoplanarContours.js +16 -0
- package/dist/esm/utilities/contours/areCoplanarContours.js.map +1 -0
- package/dist/esm/utilities/contours/index.js +2 -1
- package/dist/esm/utilities/contours/index.js.map +1 -1
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.js +3 -22
- package/dist/esm/utilities/contours/reverseIfAntiClockwise.js.map +1 -1
- package/dist/esm/utilities/math/aabb/index.js +1 -0
- package/dist/esm/utilities/math/aabb/index.js.map +1 -1
- package/dist/esm/utilities/math/aabb/intersectAABB.js +7 -0
- package/dist/esm/utilities/math/aabb/intersectAABB.js.map +1 -0
- package/dist/esm/utilities/math/point/distanceToPointSquared.js +4 -1
- package/dist/esm/utilities/math/point/distanceToPointSquared.js.map +1 -1
- package/dist/esm/utilities/math/polyline/areLineSegmentsIntersecting.js +56 -0
- package/dist/esm/utilities/math/polyline/areLineSegmentsIntersecting.js.map +1 -0
- package/dist/esm/utilities/math/polyline/combinePolyline.js +187 -0
- package/dist/esm/utilities/math/polyline/combinePolyline.js.map +1 -0
- package/dist/esm/utilities/math/polyline/containsPoint.js +30 -0
- package/dist/esm/utilities/math/polyline/containsPoint.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getAABB.js +15 -0
- package/dist/esm/utilities/math/polyline/getAABB.js.map +1 -0
- package/dist/esm/utilities/math/polyline/{calculateAreaOfPoints.js → getArea.js} +2 -2
- package/dist/esm/utilities/math/polyline/getArea.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getClosestLineSegmentIntersection.js +45 -0
- package/dist/esm/utilities/math/polyline/getClosestLineSegmentIntersection.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js +22 -0
- package/dist/esm/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js +14 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js +16 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentIntersectionsIndexes.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js +18 -0
- package/dist/esm/utilities/math/polyline/getLineSegmentsIntersection.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getNormal2.js +6 -0
- package/dist/esm/utilities/math/polyline/getNormal2.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getNormal3.js +26 -0
- package/dist/esm/utilities/math/polyline/getNormal3.js.map +1 -0
- package/dist/esm/utilities/math/polyline/getSignedArea.js +17 -0
- package/dist/esm/utilities/math/polyline/getSignedArea.js.map +1 -0
- package/dist/esm/utilities/math/polyline/index.js +14 -3
- package/dist/esm/utilities/math/polyline/index.js.map +1 -1
- package/dist/esm/utilities/math/polyline/intersectPolyline.js +14 -0
- package/dist/esm/utilities/math/polyline/intersectPolyline.js.map +1 -0
- package/dist/esm/utilities/math/polyline/isClosed.js +13 -0
- package/dist/esm/utilities/math/polyline/isClosed.js.map +1 -0
- package/dist/types/eventListeners/annotations/annotationCompletedListener.d.ts +3 -0
- package/dist/types/eventListeners/annotations/annotationCompletedListener.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts +3 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/index.d.ts +2 -0
- package/dist/types/eventListeners/annotations/contourSegmentation/index.d.ts.map +1 -0
- package/dist/types/eventListeners/annotations/index.d.ts +2 -1
- package/dist/types/eventListeners/annotations/index.d.ts.map +1 -1
- package/dist/types/eventListeners/index.d.ts +2 -2
- package/dist/types/eventListeners/index.d.ts.map +1 -1
- package/dist/types/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts +4 -0
- package/dist/types/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.d.ts.map +1 -0
- package/dist/types/eventListeners/segmentation/segmentationDataModifiedEventListener.d.ts.map +1 -1
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/stateManagement/annotation/helpers/state.d.ts +3 -1
- package/dist/types/stateManagement/annotation/helpers/state.d.ts.map +1 -1
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts +1 -0
- package/dist/types/store/ToolGroupManager/ToolGroup.d.ts.map +1 -1
- package/dist/types/store/addTool.d.ts +1 -0
- package/dist/types/store/addTool.d.ts.map +1 -1
- package/dist/types/store/index.d.ts +2 -2
- package/dist/types/store/index.d.ts.map +1 -1
- package/dist/types/store/removeEnabledElement.d.ts.map +1 -1
- package/dist/types/tools/AdvancedMagnifyTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/AngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/ArrowAnnotateTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/BidirectionalTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/CircleROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/CobbAngleTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/EllipticalROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/KeyImageTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/LengthTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/LivewireContourTool.d.ts +4 -1
- package/dist/types/tools/annotation/LivewireContourTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts +2 -1
- package/dist/types/tools/annotation/PlanarFreehandContourSegmentationTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts +2 -10
- package/dist/types/tools/annotation/PlanarFreehandROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/ProbeTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/RectangleROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/SplineROITool.d.ts +8 -9
- package/dist/types/tools/annotation/SplineROITool.d.ts.map +1 -1
- package/dist/types/tools/annotation/UltrasoundDirectionalTool.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/closedContourEditLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/drawLoop.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/editLoopCommon.d.ts.map +1 -1
- package/dist/types/tools/annotation/planarFreehandROITool/openContourEditLoop.d.ts.map +1 -1
- package/dist/types/tools/base/ContourBaseTool.d.ts +2 -8
- package/dist/types/tools/base/ContourBaseTool.d.ts.map +1 -1
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts +3 -2
- package/dist/types/tools/base/ContourSegmentationBaseTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleROIStartEndThresholdTool.d.ts.map +1 -1
- package/dist/types/tools/segmentation/RectangleROIThresholdTool.d.ts.map +1 -1
- package/dist/types/types/AnnotationRenderContext.d.ts +12 -0
- package/dist/types/types/AnnotationRenderContext.d.ts.map +1 -0
- package/dist/types/types/IToolGroup.d.ts +2 -1
- package/dist/types/types/IToolGroup.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utilities/contourSegmentation/areSameSegment.d.ts +3 -0
- package/dist/types/utilities/contourSegmentation/areSameSegment.d.ts.map +1 -0
- package/dist/types/utilities/contourSegmentation/index.d.ts +3 -0
- package/dist/types/utilities/contourSegmentation/index.d.ts.map +1 -0
- package/dist/types/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts +4 -0
- package/dist/types/utilities/contourSegmentation/isContourSegmentationAnnotation.d.ts.map +1 -0
- package/dist/types/utilities/contours/areCoplanarContours.d.ts +3 -0
- package/dist/types/utilities/contours/areCoplanarContours.d.ts.map +1 -0
- package/dist/types/utilities/contours/index.d.ts +2 -1
- package/dist/types/utilities/contours/index.d.ts.map +1 -1
- package/dist/types/utilities/contours/reverseIfAntiClockwise.d.ts.map +1 -1
- package/dist/types/utilities/math/aabb/index.d.ts +1 -0
- package/dist/types/utilities/math/aabb/index.d.ts.map +1 -1
- package/dist/types/utilities/math/aabb/intersectAABB.d.ts +3 -0
- package/dist/types/utilities/math/aabb/intersectAABB.d.ts.map +1 -0
- package/dist/types/utilities/math/point/distanceToPointSquared.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/areLineSegmentsIntersecting.d.ts +3 -0
- package/dist/types/utilities/math/polyline/areLineSegmentsIntersecting.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/combinePolyline.d.ts +5 -0
- package/dist/types/utilities/math/polyline/combinePolyline.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/containsPoint.d.ts +3 -0
- package/dist/types/utilities/math/polyline/containsPoint.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getAABB.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getAABB.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getArea.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getArea.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts +6 -0
- package/dist/types/utilities/math/polyline/getClosestLineSegmentIntersection.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentIntersectionsIndexes.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getLineSegmentsIntersection.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getNormal2.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getNormal2.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getNormal3.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getNormal3.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/getSignedArea.d.ts +3 -0
- package/dist/types/utilities/math/polyline/getSignedArea.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/index.d.ts +14 -3
- package/dist/types/utilities/math/polyline/index.d.ts.map +1 -1
- package/dist/types/utilities/math/polyline/intersectPolyline.d.ts +3 -0
- package/dist/types/utilities/math/polyline/intersectPolyline.d.ts.map +1 -0
- package/dist/types/utilities/math/polyline/isClosed.d.ts +3 -0
- package/dist/types/utilities/math/polyline/isClosed.d.ts.map +1 -0
- package/dist/umd/index.js +1 -2
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/eventListeners/annotations/annotationCompletedListener.ts +13 -0
- package/src/eventListeners/annotations/contourSegmentation/contourSegmentationCompleted.ts +273 -0
- package/src/eventListeners/annotations/contourSegmentation/index.ts +1 -0
- package/src/eventListeners/annotations/index.ts +6 -1
- package/src/eventListeners/index.ts +2 -0
- package/src/eventListeners/segmentation/labelmap/onLabelmapSegmentationDataModified.ts +117 -0
- package/src/eventListeners/segmentation/segmentationDataModifiedEventListener.ts +5 -99
- package/src/init.ts +12 -1
- package/src/stateManagement/annotation/helpers/state.ts +42 -2
- package/src/store/ToolGroupManager/ToolGroup.ts +10 -0
- package/src/store/addTool.ts +11 -0
- package/src/store/index.ts +2 -1
- package/src/store/removeEnabledElement.ts +2 -1
- package/src/tools/AdvancedMagnifyTool.ts +4 -21
- package/src/tools/annotation/AngleTool.ts +8 -32
- package/src/tools/annotation/ArrowAnnotateTool.ts +12 -45
- package/src/tools/annotation/BidirectionalTool.ts +11 -39
- package/src/tools/annotation/CircleROITool.ts +10 -34
- package/src/tools/annotation/CobbAngleTool.ts +9 -32
- package/src/tools/annotation/EllipticalROITool.ts +10 -34
- package/src/tools/annotation/KeyImageTool.ts +9 -23
- package/src/tools/annotation/LengthTool.ts +9 -33
- package/src/tools/annotation/LivewireContourTool.ts +58 -33
- package/src/tools/annotation/PlanarFreehandContourSegmentationTool.ts +22 -1
- package/src/tools/annotation/PlanarFreehandROITool.ts +10 -53
- package/src/tools/annotation/ProbeTool.ts +11 -36
- package/src/tools/annotation/RectangleROITool.ts +11 -33
- package/src/tools/annotation/SplineROITool.ts +53 -24
- package/src/tools/annotation/UltrasoundDirectionalTool.ts +8 -29
- package/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +9 -11
- package/src/tools/annotation/planarFreehandROITool/drawLoop.ts +8 -5
- package/src/tools/annotation/planarFreehandROITool/editLoopCommon.ts +9 -8
- package/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +7 -6
- package/src/tools/base/ContourBaseTool.ts +5 -8
- package/src/tools/base/ContourSegmentationBaseTool.ts +29 -6
- package/src/tools/segmentation/RectangleROIStartEndThresholdTool.ts +3 -13
- package/src/tools/segmentation/RectangleROIThresholdTool.ts +3 -14
- package/src/types/AnnotationRenderContext.ts +13 -0
- package/src/types/IToolGroup.ts +3 -1
- package/src/types/index.ts +3 -0
- package/src/utilities/contourSegmentation/areSameSegment.ts +24 -0
- package/src/utilities/contourSegmentation/index.ts +2 -0
- package/src/utilities/contourSegmentation/isContourSegmentationAnnotation.ts +8 -0
- package/src/utilities/contours/areCoplanarContours.ts +39 -0
- package/src/utilities/contours/index.ts +2 -0
- package/src/utilities/contours/reverseIfAntiClockwise.ts +6 -25
- package/src/utilities/math/aabb/index.ts +1 -0
- package/src/utilities/math/aabb/intersectAABB.ts +19 -0
- package/src/utilities/math/point/distanceToPointSquared.ts +6 -1
- package/src/utilities/math/polyline/areLineSegmentsIntersecting.ts +118 -0
- package/src/utilities/math/polyline/combinePolyline.ts +350 -0
- package/src/utilities/math/polyline/containsPoint.ts +63 -0
- package/src/utilities/math/polyline/getAABB.ts +20 -0
- package/src/utilities/math/polyline/{calculateAreaOfPoints.ts → getArea.ts} +1 -1
- package/src/utilities/math/polyline/getClosestLineSegmentIntersection.ts +72 -0
- package/src/utilities/math/polyline/getFirstLineSegmentIntersectionIndexes.ts +42 -0
- package/src/utilities/math/polyline/getLineSegmentIntersectionsCoordinates.ts +30 -0
- package/src/utilities/math/polyline/getLineSegmentIntersectionsIndexes.ts +35 -0
- package/src/utilities/math/polyline/getLineSegmentsIntersection.ts +47 -0
- package/src/utilities/math/polyline/getNormal2.ts +17 -0
- package/src/utilities/math/polyline/getNormal3.ts +53 -0
- package/src/utilities/math/polyline/getSignedArea.ts +47 -0
- package/src/utilities/math/polyline/index.ts +27 -8
- package/src/utilities/math/polyline/intersectPolyline.ts +34 -0
- package/src/utilities/math/polyline/isClosed.ts +26 -0
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.d.ts +0 -2
- package/dist/cjs/utilities/math/polyline/calculateAreaOfPoints.js.map +0 -1
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.d.ts +0 -9
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.js +0 -160
- package/dist/cjs/utilities/math/polyline/getIntersectionWithPolyline.js.map +0 -1
- package/dist/cjs/utilities/math/polyline/pointInPolyline.d.ts +0 -2
- package/dist/cjs/utilities/math/polyline/pointInPolyline.js +0 -15
- package/dist/cjs/utilities/math/polyline/pointInPolyline.js.map +0 -1
- package/dist/esm/utilities/math/polyline/calculateAreaOfPoints.js.map +0 -1
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.js +0 -154
- package/dist/esm/utilities/math/polyline/getIntersectionWithPolyline.js.map +0 -1
- package/dist/esm/utilities/math/polyline/pointInPolyline.js +0 -12
- package/dist/esm/utilities/math/polyline/pointInPolyline.js.map +0 -1
- package/dist/types/utilities/math/polyline/calculateAreaOfPoints.d.ts +0 -3
- package/dist/types/utilities/math/polyline/calculateAreaOfPoints.d.ts.map +0 -1
- package/dist/types/utilities/math/polyline/getIntersectionWithPolyline.d.ts +0 -10
- package/dist/types/utilities/math/polyline/getIntersectionWithPolyline.d.ts.map +0 -1
- package/dist/types/utilities/math/polyline/pointInPolyline.d.ts +0 -3
- package/dist/types/utilities/math/polyline/pointInPolyline.d.ts.map +0 -1
- package/dist/umd/index.js.LICENSE.txt +0 -6
- package/src/utilities/math/polyline/getIntersectionWithPolyline.ts +0 -275
- package/src/utilities/math/polyline/pointInPolyline.ts +0 -19
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { getEnabledElement, cache, StackViewport,
|
|
1
|
+
import { getEnabledElement, cache, StackViewport, utilities as csUtils, } from '@cornerstonejs/core';
|
|
2
2
|
import { addAnnotation, getAnnotations } from '../../stateManagement';
|
|
3
3
|
import { isAnnotationLocked } from '../../stateManagement/annotation/annotationLocking';
|
|
4
|
-
import { Events } from '../../enums';
|
|
5
4
|
import { drawHandles as drawHandlesSvg, drawRect as drawRectSvg, } from '../../drawingSvg';
|
|
6
5
|
import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters';
|
|
7
6
|
import { hideElementCursor } from '../../cursors/elementCursor';
|
|
8
7
|
import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds';
|
|
9
8
|
import { isAnnotationVisible } from '../../stateManagement/annotation/annotationVisibility';
|
|
9
|
+
import { triggerAnnotationModified } from '../../stateManagement/annotation/helpers/state';
|
|
10
10
|
import RectangleROITool from '../annotation/RectangleROITool';
|
|
11
11
|
class RectangleROIThresholdTool extends RectangleROITool {
|
|
12
12
|
constructor(toolProps = {}, defaultToolProps = {
|
|
@@ -85,7 +85,7 @@ class RectangleROIThresholdTool extends RectangleROITool {
|
|
|
85
85
|
};
|
|
86
86
|
this.renderAnnotation = (enabledElement, svgDrawingHelper) => {
|
|
87
87
|
let renderStatus = false;
|
|
88
|
-
const { viewport
|
|
88
|
+
const { viewport } = enabledElement;
|
|
89
89
|
const { element } = viewport;
|
|
90
90
|
let annotations = getAnnotations(this.getToolName(), element);
|
|
91
91
|
if (!annotations?.length) {
|
|
@@ -113,13 +113,7 @@ class RectangleROIThresholdTool extends RectangleROITool {
|
|
|
113
113
|
console.warn('Rendering Engine has been destroyed');
|
|
114
114
|
return renderStatus;
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
const eventDetail = {
|
|
118
|
-
annotation,
|
|
119
|
-
viewportId: viewport.id,
|
|
120
|
-
renderingEngineId,
|
|
121
|
-
};
|
|
122
|
-
triggerEvent(eventTarget, eventType, eventDetail);
|
|
116
|
+
triggerAnnotationModified(annotation, element);
|
|
123
117
|
let activeHandleCanvasCoords;
|
|
124
118
|
if (!isAnnotationVisible(annotationUID)) {
|
|
125
119
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RectangleROIThresholdTool.js","sourceRoot":"","sources":["../../../../src/tools/segmentation/RectangleROIThresholdTool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,EACL,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"RectangleROIThresholdTool.js","sourceRoot":"","sources":["../../../../src/tools/segmentation/RectangleROIThresholdTool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,EACL,aAAa,EACb,SAAS,IAAI,OAAO,GACrB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAExF,OAAO,EACL,WAAW,IAAI,cAAc,EAC7B,QAAQ,IAAI,WAAW,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,qCAAqC,MAAM,uDAAuD,CAAC;AAC1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAQ3F,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAS9D,MAAM,yBAA0B,SAAQ,gBAAgB;IAatD,YACE,YAA6B,EAAE,EAC/B,mBAA8B;QAC5B,yBAAyB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;QAC7C,aAAa,EAAE;YACb,MAAM,EAAE,IAAI;YACZ,yBAAyB,EAAE,KAAK;SACjC;KACF;QAED,KAAK,CAAC,SAAS,EAAE,gB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BAAkB,EAAE,EAAE;oBAClC,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;oBACpD,OAAO,YAAY,CAAC;iBACrB;gBAKD,yBAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;gBAE/C,IAAI,wBAAwB,CAAC;gBAE7B,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE;oBACvC,SAAS;iBACV;gBAED,IACE,CAAC,kBAAkB,CAAC,UAAU,CAAC;oBAC/B,CAAC,IAAI,CAAC,QAAQ;oBACd,iBAAiB,KAAK,IAAI,EAC1B;oBAEA,wBAAwB,GAAG,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC;iBACnE;gBAED,IAAI,wBAAwB,EAAE;oBAC5B,MAAM,cAAc,GAAG,GAAG,CAAC;oBAE3B,cAAc,CACZ,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB;wBACE,KAAK;qBACN,CACF,CAAC;iBACH;gBAED,MAAM,YAAY,GAAG,GAAG,CAAC;gBACzB,WAAW,CACT,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,iBAAiB,CAAC,CAAC,CAAC,EACpB,iBAAiB,CAAC,CAAC,CAAC,EACpB;oBACE,KAAK;oBACL,QAAQ;oBACR,SAAS;iBACV,CACF,CAAC;gBAEF,YAAY,GAAG,IAAI,CAAC;aACrB;YAED,OAAO,YAAY,CAAC;QACtB,CAAC,CAAC;IA5MF,CAAC;CA6MF;AAED,yBAAyB,CAAC,QAAQ,GAAG,uBAAuB,CAAC;AAC7D,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationRenderContext.js","sourceRoot":"","sources":["../../../src/types/AnnotationRenderContext.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default function areSameSegment(firstAnnotation, secondAnnotation) {
|
|
2
|
+
const { segmentation: firstSegmentation } = firstAnnotation.data;
|
|
3
|
+
const { segmentation: secondSegmentation } = secondAnnotation.data;
|
|
4
|
+
return (firstSegmentation.segmentationId === secondSegmentation.segmentationId &&
|
|
5
|
+
firstSegmentation.segmentationRepresentationUID ===
|
|
6
|
+
secondSegmentation.segmentationRepresentationUID &&
|
|
7
|
+
firstSegmentation.segmentIndex === secondSegmentation.segmentIndex);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=areSameSegment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areSameSegment.js","sourceRoot":"","sources":["../../../../src/utilities/contourSegmentation/areSameSegment.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,eAA8C,EAC9C,gBAA+C;IAE/C,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC;IACjE,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC;IAEnE,OAAO,CACL,iBAAiB,CAAC,cAAc,KAAK,kBAAkB,CAAC,cAAc;QACtE,iBAAiB,CAAC,6BAA6B;YAC7C,kBAAkB,CAAC,6BAA6B;QAClD,iBAAiB,CAAC,YAAY,KAAK,kBAAkB,CAAC,YAAY,CACnE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/contourSegmentation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isContourSegmentationAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/contourSegmentation/isContourSegmentationAnnotation.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,+BAA+B,CACrD,UAAsB;IAEtB,OAAO,CAAC,CAAiC,UAAW,CAAC,IAAI,EAAE,YAAY,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { glMatrix, vec3 } from 'gl-matrix';
|
|
2
|
+
export default function areCoplanarContours(firstAnnotation, secondAnnotation) {
|
|
3
|
+
const { viewPlaneNormal: firstViewPlaneNormal } = firstAnnotation.metadata;
|
|
4
|
+
const { viewPlaneNormal: secondViewPlaneNormal } = secondAnnotation.metadata;
|
|
5
|
+
const dot = vec3.dot(firstViewPlaneNormal, secondViewPlaneNormal);
|
|
6
|
+
const parallelPlanes = glMatrix.equals(1, Math.abs(dot));
|
|
7
|
+
if (!parallelPlanes) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const { polyline: firstPolyline } = firstAnnotation.data.contour;
|
|
11
|
+
const { polyline: secondPolyline } = secondAnnotation.data.contour;
|
|
12
|
+
const firstDistance = vec3.dot(firstViewPlaneNormal, firstPolyline[0]);
|
|
13
|
+
const secondDistance = vec3.dot(firstViewPlaneNormal, secondPolyline[0]);
|
|
14
|
+
return glMatrix.equals(firstDistance, secondDistance);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=areCoplanarContours.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areCoplanarContours.js","sourceRoot":"","sources":["../../../../src/utilities/contours/areCoplanarContours.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAc3C,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,eAAkC,EAClC,gBAAmC;IAEnC,MAAM,EAAE,eAAe,EAAE,oBAAoB,EAAE,GAAG,eAAe,CAAC,QAAQ,CAAC;IAC3E,MAAM,EAAE,eAAe,EAAE,qBAAqB,EAAE,GAAG,gBAAgB,CAAC,QAAQ,CAAC;IAC7E,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,CAAC;IAClE,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAEzD,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC;IACjE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC;IAMnE,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzE,OAAO,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import areCoplanarContours from './areCoplanarContours';
|
|
1
2
|
import contourFinder from './contourFinder';
|
|
2
3
|
import mergePoints from './mergePoints';
|
|
3
4
|
import detectContourHoles from './detectContourHoles';
|
|
@@ -6,5 +7,5 @@ import AnnotationToPointData from './AnnotationToPointData';
|
|
|
6
7
|
import acceptAutogeneratedInterpolations from './interpolation/acceptAutogeneratedInterpolations';
|
|
7
8
|
import * as interpolation from './interpolation';
|
|
8
9
|
import findHandlePolylineIndex from './findHandlePolylineIndex';
|
|
9
|
-
export { contourFinder, mergePoints, detectContourHoles, generateContourSetsFromLabelmap, AnnotationToPointData, interpolation, acceptAutogeneratedInterpolations, findHandlePolylineIndex, };
|
|
10
|
+
export { areCoplanarContours, contourFinder, mergePoints, detectContourHoles, generateContourSetsFromLabelmap, AnnotationToPointData, interpolation, acceptAutogeneratedInterpolations, findHandlePolylineIndex, };
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/contours/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,iCAAiC,MAAM,mDAAmD,CAAC;AAClG,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EACL,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,qBAAqB,EACrB,aAAa,EACb,iCAAiC,EACjC,uBAAuB,GACxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/contours/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,iCAAiC,MAAM,mDAAmD,CAAC;AAClG,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,qBAAqB,EACrB,aAAa,EACb,iCAAiC,EACjC,uBAAuB,GACxB,CAAC"}
|
|
@@ -1,26 +1,7 @@
|
|
|
1
|
+
import { getSignedArea } from '../math/polyline';
|
|
1
2
|
export default function reverseIfAntiClockwise(points, ...otherListsToReverse) {
|
|
2
|
-
const
|
|
3
|
-
if (
|
|
4
|
-
return points;
|
|
5
|
-
}
|
|
6
|
-
let xSum = 0;
|
|
7
|
-
for (const point of points) {
|
|
8
|
-
xSum += point[0];
|
|
9
|
-
}
|
|
10
|
-
const xMean = xSum / length;
|
|
11
|
-
let checkSum = 0;
|
|
12
|
-
for (let k = 0, i = 1, j = 2; k < length; k++) {
|
|
13
|
-
checkSum += (points[i][0] - xMean) * (points[j][1] - points[k][1]);
|
|
14
|
-
i++;
|
|
15
|
-
j++;
|
|
16
|
-
if (i >= length) {
|
|
17
|
-
i = 0;
|
|
18
|
-
}
|
|
19
|
-
if (j >= length) {
|
|
20
|
-
j = 0;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if (checkSum < 0) {
|
|
3
|
+
const signedArea = getSignedArea(points);
|
|
4
|
+
if (signedArea < 0) {
|
|
24
5
|
if (otherListsToReverse) {
|
|
25
6
|
otherListsToReverse.forEach((list) => list.reverse());
|
|
26
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reverseIfAntiClockwise.js","sourceRoot":"","sources":["../../../../src/utilities/contours/reverseIfAntiClockwise.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reverseIfAntiClockwise.js","sourceRoot":"","sources":["../../../../src/utilities/contours/reverseIfAntiClockwise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAWjD,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,MAAsB,EACtB,GAAG,mBAAgC;IAEnC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAGzC,IAAI,UAAU,GAAG,CAAC,EAAE;QAClB,IAAI,mBAAmB,EAAE;YACvB,mBAAmB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;SACvD;QAED,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC;KACjC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utilities/math/aabb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utilities/math/aabb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersectAABB.js","sourceRoot":"","sources":["../../../../../src/utilities/math/aabb/intersectAABB.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,KAAkB,EAClB,KAAkB;IAElB,OAAO,CACL,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI;QACxB,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI;QACxB,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI;QACxB,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CACzB,CAAC;AACJ,CAAC"}
|
|
@@ -4,6 +4,9 @@ export default function distanceToPointSquared(p1, p2) {
|
|
|
4
4
|
}
|
|
5
5
|
const [x1, y1, z1 = 0] = p1;
|
|
6
6
|
const [x2, y2, z2 = 0] = p2;
|
|
7
|
-
|
|
7
|
+
const dx = x2 - x1;
|
|
8
|
+
const dy = y2 - y1;
|
|
9
|
+
const dz = z2 - z1;
|
|
10
|
+
return dx * dx + dy * dy + dz * dz;
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=distanceToPointSquared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distanceToPointSquared.js","sourceRoot":"","sources":["../../../../../src/utilities/math/point/distanceToPointSquared.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAS,EAAE,EAAS;IACjE,IAAI,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE;QAC3B,MAAM,KAAK,CAAC,iDAAiD,CAAC,CAAC;KAChE;IAED,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"distanceToPointSquared.js","sourceRoot":"","sources":["../../../../../src/utilities/math/point/distanceToPointSquared.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAS,EAAE,EAAS;IACjE,IAAI,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE;QAC3B,MAAM,KAAK,CAAC,iDAAiD,CAAC,CAAC;KAChE;IAED,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5B,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACnB,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACnB,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAInB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export default function areLineSegmentsIntersecting(p1, q1, p2, q2) {
|
|
2
|
+
let result = false;
|
|
3
|
+
const line1MinX = p1[0] < q1[0] ? p1[0] : q1[0];
|
|
4
|
+
const line1MinY = p1[1] < q1[1] ? p1[1] : q1[1];
|
|
5
|
+
const line1MaxX = p1[0] > q1[0] ? p1[0] : q1[0];
|
|
6
|
+
const line1MaxY = p1[1] > q1[1] ? p1[1] : q1[1];
|
|
7
|
+
const line2MinX = p2[0] < q2[0] ? p2[0] : q2[0];
|
|
8
|
+
const line2MinY = p2[1] < q2[1] ? p2[1] : q2[1];
|
|
9
|
+
const line2MaxX = p2[0] > q2[0] ? p2[0] : q2[0];
|
|
10
|
+
const line2MaxY = p2[1] > q2[1] ? p2[1] : q2[1];
|
|
11
|
+
if (line1MinX > line2MaxX ||
|
|
12
|
+
line1MaxX < line2MinX ||
|
|
13
|
+
line1MinY > line2MaxY ||
|
|
14
|
+
line1MaxY < line2MinY) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const orient = [
|
|
18
|
+
orientation(p1, q1, p2),
|
|
19
|
+
orientation(p1, q1, q2),
|
|
20
|
+
orientation(p2, q2, p1),
|
|
21
|
+
orientation(p2, q2, q1),
|
|
22
|
+
];
|
|
23
|
+
if (orient[0] !== orient[1] && orient[2] !== orient[3]) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (orient[0] === 0 && onSegment(p1, p2, q1)) {
|
|
27
|
+
result = true;
|
|
28
|
+
}
|
|
29
|
+
else if (orient[1] === 0 && onSegment(p1, q2, q1)) {
|
|
30
|
+
result = true;
|
|
31
|
+
}
|
|
32
|
+
else if (orient[2] === 0 && onSegment(p2, p1, q2)) {
|
|
33
|
+
result = true;
|
|
34
|
+
}
|
|
35
|
+
else if (orient[3] === 0 && onSegment(p2, q1, q2)) {
|
|
36
|
+
result = true;
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
function orientation(p, q, r) {
|
|
41
|
+
const orientationValue = (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1]);
|
|
42
|
+
if (orientationValue === 0) {
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
return orientationValue > 0 ? 1 : 2;
|
|
46
|
+
}
|
|
47
|
+
function onSegment(p, q, r) {
|
|
48
|
+
if (q[0] <= Math.max(p[0], r[0]) &&
|
|
49
|
+
q[0] >= Math.min(p[0], r[0]) &&
|
|
50
|
+
q[1] <= Math.max(p[1], r[1]) &&
|
|
51
|
+
q[1] >= Math.min(p[1], r[1])) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=areLineSegmentsIntersecting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areLineSegmentsIntersecting.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/areLineSegmentsIntersecting.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,2BAA2B,CACjD,EAAgB,EAChB,EAAgB,EAChB,EAAgB,EAChB,EAAgB;IAEhB,IAAI,MAAM,GAAG,KAAK,CAAC;IAGnB,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,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G,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,IAAI,gBAAgB,KAAK,CAAC,EAAE;QAC1B,OAAO,CAAC,CAAC;KACV;IAED,OAAO,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAKD,SAAS,SAAS,CAAC,CAAe,EAAE,CAAe,EAAE,CAAe;IAClE,IACE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAC5B;QACA,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import * as mathPoint from '../point';
|
|
2
|
+
import getLineSegmentIntersectionsIndexes from './getLineSegmentIntersectionsIndexes';
|
|
3
|
+
import containsPoint from './containsPoint';
|
|
4
|
+
import getNormal2 from './getNormal2';
|
|
5
|
+
import { glMatrix, vec3 } from 'gl-matrix';
|
|
6
|
+
import getLineSegmentsIntersection from './getLineSegmentsIntersection';
|
|
7
|
+
var PolylinePointType;
|
|
8
|
+
(function (PolylinePointType) {
|
|
9
|
+
PolylinePointType[PolylinePointType["Vertex"] = 0] = "Vertex";
|
|
10
|
+
PolylinePointType[PolylinePointType["Intersection"] = 1] = "Intersection";
|
|
11
|
+
})(PolylinePointType || (PolylinePointType = {}));
|
|
12
|
+
var PolylinePointPosition;
|
|
13
|
+
(function (PolylinePointPosition) {
|
|
14
|
+
PolylinePointPosition[PolylinePointPosition["Outside"] = -1] = "Outside";
|
|
15
|
+
PolylinePointPosition[PolylinePointPosition["Edge"] = 0] = "Edge";
|
|
16
|
+
PolylinePointPosition[PolylinePointPosition["Inside"] = 1] = "Inside";
|
|
17
|
+
})(PolylinePointPosition || (PolylinePointPosition = {}));
|
|
18
|
+
var PolylinePointDirection;
|
|
19
|
+
(function (PolylinePointDirection) {
|
|
20
|
+
PolylinePointDirection[PolylinePointDirection["Exiting"] = -1] = "Exiting";
|
|
21
|
+
PolylinePointDirection[PolylinePointDirection["Unknown"] = 0] = "Unknown";
|
|
22
|
+
PolylinePointDirection[PolylinePointDirection["Entering"] = 1] = "Entering";
|
|
23
|
+
})(PolylinePointDirection || (PolylinePointDirection = {}));
|
|
24
|
+
function ensuresNextPointers(polylinePoints) {
|
|
25
|
+
for (let i = 0, len = polylinePoints.length; i < len; i++) {
|
|
26
|
+
const currentPoint = polylinePoints[i];
|
|
27
|
+
if (!currentPoint.next) {
|
|
28
|
+
currentPoint.next = polylinePoints[i === len - 1 ? 0 : i + 1];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function getSourceAndTargetPointsList(targetPolyline, sourcePolyline) {
|
|
33
|
+
const targetPolylinePoints = [];
|
|
34
|
+
const sourcePolylinePoints = [];
|
|
35
|
+
const sourceIntersectionsCache = new Map();
|
|
36
|
+
const isFisrtPointInside = containsPoint(sourcePolyline, targetPolyline[0]);
|
|
37
|
+
let intersectionPointDirection = isFisrtPointInside
|
|
38
|
+
? PolylinePointDirection.Exiting
|
|
39
|
+
: PolylinePointDirection.Entering;
|
|
40
|
+
for (let i = 0, len = targetPolyline.length; i < len; i++) {
|
|
41
|
+
const p1 = targetPolyline[i];
|
|
42
|
+
const pointInside = containsPoint(sourcePolyline, p1);
|
|
43
|
+
const vertexPoint = {
|
|
44
|
+
type: PolylinePointType.Vertex,
|
|
45
|
+
coordinates: p1,
|
|
46
|
+
position: pointInside
|
|
47
|
+
? PolylinePointPosition.Inside
|
|
48
|
+
: PolylinePointPosition.Outside,
|
|
49
|
+
visited: false,
|
|
50
|
+
next: null,
|
|
51
|
+
};
|
|
52
|
+
targetPolylinePoints.push(vertexPoint);
|
|
53
|
+
const q1 = targetPolyline[i === len - 1 ? 0 : i + 1];
|
|
54
|
+
const intersectionsInfo = getLineSegmentIntersectionsIndexes(sourcePolyline, p1, q1).map((intersectedLineSegment) => {
|
|
55
|
+
const sourceLineSegmentId = intersectedLineSegment[0];
|
|
56
|
+
const p2 = sourcePolyline[intersectedLineSegment[0]];
|
|
57
|
+
const q2 = sourcePolyline[intersectedLineSegment[1]];
|
|
58
|
+
const intersectionCoordinate = getLineSegmentsIntersection(p1, q1, p2, q2);
|
|
59
|
+
const targetStartPointDistSquared = mathPoint.distanceToPointSquared(p1, intersectionCoordinate);
|
|
60
|
+
return {
|
|
61
|
+
sourceLineSegmentId,
|
|
62
|
+
coordinate: intersectionCoordinate,
|
|
63
|
+
targetStartPointDistSquared,
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
intersectionsInfo.sort((left, right) => left.targetStartPointDistSquared - right.targetStartPointDistSquared);
|
|
67
|
+
intersectionsInfo.forEach((intersectionInfo) => {
|
|
68
|
+
const { sourceLineSegmentId, coordinate: intersectionCoordinate } = intersectionInfo;
|
|
69
|
+
const targetEdgePoint = {
|
|
70
|
+
type: PolylinePointType.Intersection,
|
|
71
|
+
coordinates: intersectionCoordinate,
|
|
72
|
+
position: PolylinePointPosition.Edge,
|
|
73
|
+
direction: intersectionPointDirection,
|
|
74
|
+
visited: false,
|
|
75
|
+
next: null,
|
|
76
|
+
};
|
|
77
|
+
const sourceEdgePoint = {
|
|
78
|
+
...targetEdgePoint,
|
|
79
|
+
direction: PolylinePointDirection.Unknown,
|
|
80
|
+
cloned: true,
|
|
81
|
+
};
|
|
82
|
+
if (intersectionPointDirection === PolylinePointDirection.Entering) {
|
|
83
|
+
targetEdgePoint.next = sourceEdgePoint;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
sourceEdgePoint.next = targetEdgePoint;
|
|
87
|
+
}
|
|
88
|
+
let sourceIntersectionPoints = sourceIntersectionsCache.get(sourceLineSegmentId);
|
|
89
|
+
if (!sourceIntersectionPoints) {
|
|
90
|
+
sourceIntersectionPoints = [];
|
|
91
|
+
sourceIntersectionsCache.set(sourceLineSegmentId, sourceIntersectionPoints);
|
|
92
|
+
}
|
|
93
|
+
targetPolylinePoints.push(targetEdgePoint);
|
|
94
|
+
sourceIntersectionPoints.push(sourceEdgePoint);
|
|
95
|
+
intersectionPointDirection *= -1;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
for (let i = 0, len = sourcePolyline.length; i < len; i++) {
|
|
99
|
+
const lineSegmentId = i;
|
|
100
|
+
const p1 = sourcePolyline[i];
|
|
101
|
+
const vertexPoint = {
|
|
102
|
+
type: PolylinePointType.Vertex,
|
|
103
|
+
coordinates: p1,
|
|
104
|
+
visited: false,
|
|
105
|
+
next: null,
|
|
106
|
+
};
|
|
107
|
+
sourcePolylinePoints.push(vertexPoint);
|
|
108
|
+
const sourceIntersectionPoints = sourceIntersectionsCache.get(lineSegmentId);
|
|
109
|
+
if (!sourceIntersectionPoints?.length) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
sourceIntersectionPoints
|
|
113
|
+
.map((intersectionPoint) => ({
|
|
114
|
+
intersectionPoint,
|
|
115
|
+
lineSegStartDistSquared: mathPoint.distanceToPointSquared(p1, intersectionPoint.coordinates),
|
|
116
|
+
}))
|
|
117
|
+
.sort((left, right) => left.lineSegStartDistSquared - right.lineSegStartDistSquared)
|
|
118
|
+
.map(({ intersectionPoint }) => intersectionPoint)
|
|
119
|
+
.forEach((intersectionPoint) => sourcePolylinePoints.push(intersectionPoint));
|
|
120
|
+
}
|
|
121
|
+
ensuresNextPointers(targetPolylinePoints);
|
|
122
|
+
ensuresNextPointers(sourcePolylinePoints);
|
|
123
|
+
return { targetPolylinePoints, sourcePolylinePoints };
|
|
124
|
+
}
|
|
125
|
+
function getUnvisitedOutsidePoint(polylinePoints) {
|
|
126
|
+
for (let i = 0, len = polylinePoints.length; i < len; i++) {
|
|
127
|
+
const point = polylinePoints[i];
|
|
128
|
+
if (!point.visited && point.position === PolylinePointPosition.Outside) {
|
|
129
|
+
return point;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function mergePolylines(targetPolyline, sourcePolyline) {
|
|
134
|
+
const targetNormal = getNormal2(targetPolyline);
|
|
135
|
+
const sourceNormal = getNormal2(sourcePolyline);
|
|
136
|
+
const dotNormals = vec3.dot(sourceNormal, targetNormal);
|
|
137
|
+
if (!glMatrix.equals(1, dotNormals)) {
|
|
138
|
+
sourcePolyline = sourcePolyline.slice().reverse();
|
|
139
|
+
}
|
|
140
|
+
const { targetPolylinePoints } = getSourceAndTargetPointsList(targetPolyline, sourcePolyline);
|
|
141
|
+
const startPoint = getUnvisitedOutsidePoint(targetPolylinePoints);
|
|
142
|
+
if (!startPoint) {
|
|
143
|
+
return targetPolyline.slice();
|
|
144
|
+
}
|
|
145
|
+
const mergedPolyline = [startPoint.coordinates];
|
|
146
|
+
let currentPoint = startPoint.next;
|
|
147
|
+
while (currentPoint !== startPoint) {
|
|
148
|
+
if (currentPoint.type === PolylinePointType.Intersection &&
|
|
149
|
+
currentPoint.cloned) {
|
|
150
|
+
currentPoint = currentPoint.next;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
mergedPolyline.push(currentPoint.coordinates);
|
|
154
|
+
currentPoint = currentPoint.next;
|
|
155
|
+
}
|
|
156
|
+
return mergedPolyline;
|
|
157
|
+
}
|
|
158
|
+
function subtractPolylines(targetPolyline, sourcePolyline) {
|
|
159
|
+
const targetNormal = getNormal2(targetPolyline);
|
|
160
|
+
const sourceNormal = getNormal2(sourcePolyline);
|
|
161
|
+
const dotNormals = vec3.dot(sourceNormal, targetNormal);
|
|
162
|
+
if (!glMatrix.equals(-1, dotNormals)) {
|
|
163
|
+
sourcePolyline = sourcePolyline.slice().reverse();
|
|
164
|
+
}
|
|
165
|
+
const { targetPolylinePoints } = getSourceAndTargetPointsList(targetPolyline, sourcePolyline);
|
|
166
|
+
let startPoint = null;
|
|
167
|
+
const subtractedPolylines = [];
|
|
168
|
+
while ((startPoint = getUnvisitedOutsidePoint(targetPolylinePoints))) {
|
|
169
|
+
const subtractedPolyline = [startPoint.coordinates];
|
|
170
|
+
let currentPoint = startPoint.next;
|
|
171
|
+
startPoint.visited = true;
|
|
172
|
+
while (currentPoint !== startPoint) {
|
|
173
|
+
currentPoint.visited = true;
|
|
174
|
+
if (currentPoint.type === PolylinePointType.Intersection &&
|
|
175
|
+
currentPoint.cloned) {
|
|
176
|
+
currentPoint = currentPoint.next;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
subtractedPolyline.push(currentPoint.coordinates);
|
|
180
|
+
currentPoint = currentPoint.next;
|
|
181
|
+
}
|
|
182
|
+
subtractedPolylines.push(subtractedPolyline);
|
|
183
|
+
}
|
|
184
|
+
return subtractedPolylines;
|
|
185
|
+
}
|
|
186
|
+
export { mergePolylines, subtractPolylines };
|
|
187
|
+
//# sourceMappingURL=combinePolyline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combinePolyline.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/combinePolyline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,UAAU,CAAC;AACtC,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,UAAU,MAAM,c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AAC,WAAW,CAAC,CAAC;YAClD,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC;SAClC;QAED,mBAAmB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;KAC9C;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import isClosed from './isClosed';
|
|
2
|
+
export default function containsPoint(polyline, point, closed) {
|
|
3
|
+
if (polyline.length < 3) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
const numPolylinePoints = polyline.length;
|
|
7
|
+
let numIntersections = 0;
|
|
8
|
+
const shouldClose = !(closed === undefined ? isClosed(polyline) : closed);
|
|
9
|
+
const maxSegmentIndex = polyline.length - (shouldClose ? 1 : 2);
|
|
10
|
+
for (let i = 0; i <= maxSegmentIndex; i++) {
|
|
11
|
+
const p1 = polyline[i];
|
|
12
|
+
const p2Index = i === numPolylinePoints - 1 ? 0 : i + 1;
|
|
13
|
+
const p2 = polyline[p2Index];
|
|
14
|
+
const maxX = p1[0] >= p2[0] ? p1[0] : p2[0];
|
|
15
|
+
const maxY = p1[1] >= p2[1] ? p1[1] : p2[1];
|
|
16
|
+
const minY = p1[1] <= p2[1] ? p1[1] : p2[1];
|
|
17
|
+
const mayIntersectLineSegment = point[0] <= maxX && point[1] >= minY && point[1] < maxY;
|
|
18
|
+
if (mayIntersectLineSegment) {
|
|
19
|
+
const isVerticalLine = p1[0] === p2[0];
|
|
20
|
+
let intersects = isVerticalLine;
|
|
21
|
+
if (!intersects) {
|
|
22
|
+
const xIntersection = ((point[1] - p1[1]) * (p2[0] - p1[0])) / (p2[1] - p1[1]) + p1[0];
|
|
23
|
+
intersects = point[0] <= xIntersection;
|
|
24
|
+
}
|
|
25
|
+
numIntersections += intersects ? 1 : 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return !!(numIntersections % 2);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=containsPoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containsPoint.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/containsPoint.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAalC,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,QAAwB,EACxB,KAAmB,EACnB,MAAgB;IAEhB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC1C,IAAI,gBAAgB,GAAG,CAAC,CAAC;IAGzB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1E,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,eAAe,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAIvB,MAAM,OAAO,GAAG,CAAC,KAAK,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAG7B,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,EAAE,CAAC,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;
|
|
3
|
+
let minY = Infinity;
|
|
4
|
+
let maxX = -Infinity;
|
|
5
|
+
let maxY = -Infinity;
|
|
6
|
+
for (let i = 0, len = polyline.length; i < len; i++) {
|
|
7
|
+
const [x, y] = polyline[i];
|
|
8
|
+
minX = minX < x ? minX : x;
|
|
9
|
+
minY = minY < y ? minY : y;
|
|
10
|
+
maxX = maxX > x ? maxX : x;
|
|
11
|
+
maxY = maxY > y ? maxY : y;
|
|
12
|
+
}
|
|
13
|
+
return { minX, maxX, minY, maxY };
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=getAABB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAABB.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getAABB.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,QAAwB;IACtD,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IACrB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QACnD,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAG3B,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5B;IAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function
|
|
1
|
+
export default function getArea(points) {
|
|
2
2
|
const n = points.length;
|
|
3
3
|
let area = 0.0;
|
|
4
4
|
let j = n - 1;
|
|
@@ -8,4 +8,4 @@ export default function calculateAreaOfPoints(points) {
|
|
|
8
8
|
}
|
|
9
9
|
return Math.abs(area / 2.0);
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=getArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArea.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getArea.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,MAAsB;IAEpD,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IACxB,IAAI,IAAI,GAAG,GAAG,CAAC;IACf,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtE,CAAC,GAAG,CAAC,CAAC;KACP;IAGD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { vec2 } from 'gl-matrix';
|
|
2
|
+
import areLineSegmentsIntersecting from './areLineSegmentsIntersecting';
|
|
3
|
+
export default function getClosestLineSegmentIntersection(points, p1, q1, closed = true) {
|
|
4
|
+
let initialQ2Index;
|
|
5
|
+
let p2Index;
|
|
6
|
+
if (closed) {
|
|
7
|
+
p2Index = points.length - 1;
|
|
8
|
+
initialQ2Index = 0;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
p2Index = 0;
|
|
12
|
+
initialQ2Index = 1;
|
|
13
|
+
}
|
|
14
|
+
const intersections = [];
|
|
15
|
+
for (let q2Index = initialQ2Index; q2Index < points.length; q2Index++) {
|
|
16
|
+
const p2 = points[p2Index];
|
|
17
|
+
const q2 = points[q2Index];
|
|
18
|
+
if (areLineSegmentsIntersecting(p1, q1, p2, q2)) {
|
|
19
|
+
intersections.push([p2Index, q2Index]);
|
|
20
|
+
}
|
|
21
|
+
p2Index = q2Index;
|
|
22
|
+
}
|
|
23
|
+
if (intersections.length === 0) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const distances = [];
|
|
27
|
+
intersections.forEach((intersection) => {
|
|
28
|
+
const intersectionPoints = [
|
|
29
|
+
points[intersection[0]],
|
|
30
|
+
points[intersection[1]],
|
|
31
|
+
];
|
|
32
|
+
const midpoint = [
|
|
33
|
+
(intersectionPoints[0][0] + intersectionPoints[1][0]) / 2,
|
|
34
|
+
(intersectionPoints[0][1] + intersectionPoints[1][1]) / 2,
|
|
35
|
+
];
|
|
36
|
+
distances.push(vec2.distance(midpoint, p1));
|
|
37
|
+
});
|
|
38
|
+
const minDistance = Math.min(...distances);
|
|
39
|
+
const indexOfMinDistance = distances.indexOf(minDistance);
|
|
40
|
+
return {
|
|
41
|
+
segment: intersections[indexOfMinDistance],
|
|
42
|
+
distance: minDistance,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=getClosestLineSegmentIntersection.js.map
|