@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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function isContourSegmentationAnnotation(annotation) {
|
|
4
|
+
var _a;
|
|
5
|
+
return !!((_a = annotation.data) === null || _a === void 0 ? void 0 : _a.segmentation);
|
|
6
|
+
}
|
|
7
|
+
exports.default = isContourSegmentationAnnotation;
|
|
8
|
+
//# sourceMappingURL=isContourSegmentationAnnotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isContourSegmentationAnnotation.js","sourceRoot":"","sources":["../../../../src/utilities/contourSegmentation/isContourSegmentationAnnotation.ts"],"names":[],"mappings":";;AAGA,SAAwB,+BAA+B,CACrD,UAAsB;;IAEtB,OAAO,CAAC,CAAC,CAAA,MAAgC,UAAW,CAAC,IAAI,0CAAE,YAAY,CAAA,CAAC;AAC1E,CAAC;AAJD,kDAIC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
4
|
+
function areCoplanarContours(firstAnnotation, secondAnnotation) {
|
|
5
|
+
const { viewPlaneNormal: firstViewPlaneNormal } = firstAnnotation.metadata;
|
|
6
|
+
const { viewPlaneNormal: secondViewPlaneNormal } = secondAnnotation.metadata;
|
|
7
|
+
const dot = gl_matrix_1.vec3.dot(firstViewPlaneNormal, secondViewPlaneNormal);
|
|
8
|
+
const parallelPlanes = gl_matrix_1.glMatrix.equals(1, Math.abs(dot));
|
|
9
|
+
if (!parallelPlanes) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const { polyline: firstPolyline } = firstAnnotation.data.contour;
|
|
13
|
+
const { polyline: secondPolyline } = secondAnnotation.data.contour;
|
|
14
|
+
const firstDistance = gl_matrix_1.vec3.dot(firstViewPlaneNormal, firstPolyline[0]);
|
|
15
|
+
const secondDistance = gl_matrix_1.vec3.dot(firstViewPlaneNormal, secondPolyline[0]);
|
|
16
|
+
return gl_matrix_1.glMatrix.equals(firstDistance, secondDistance);
|
|
17
|
+
}
|
|
18
|
+
exports.default = areCoplanarContours;
|
|
19
|
+
//# sourceMappingURL=areCoplanarContours.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areCoplanarContours.js","sourceRoot":"","sources":["../../../../src/utilities/contours/areCoplanarContours.ts"],"names":[],"mappings":";;AAAA,yCAA2C;AAc3C,SAAwB,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,gBAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,CAAC;IAClE,MAAM,cAAc,GAAG,oBAAQ,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,gBAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,MAAM,cAAc,GAAG,gBAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzE,OAAO,oBAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AACxD,CAAC;AAxBD,sCAwBC"}
|
|
@@ -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,4 +7,4 @@ 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, };
|
|
@@ -26,7 +26,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.findHandlePolylineIndex = exports.acceptAutogeneratedInterpolations = exports.interpolation = exports.AnnotationToPointData = exports.generateContourSetsFromLabelmap = exports.detectContourHoles = exports.mergePoints = exports.contourFinder = void 0;
|
|
29
|
+
exports.findHandlePolylineIndex = exports.acceptAutogeneratedInterpolations = exports.interpolation = exports.AnnotationToPointData = exports.generateContourSetsFromLabelmap = exports.detectContourHoles = exports.mergePoints = exports.contourFinder = exports.areCoplanarContours = void 0;
|
|
30
|
+
const areCoplanarContours_1 = __importDefault(require("./areCoplanarContours"));
|
|
31
|
+
exports.areCoplanarContours = areCoplanarContours_1.default;
|
|
30
32
|
const contourFinder_1 = __importDefault(require("./contourFinder"));
|
|
31
33
|
exports.contourFinder = contourFinder_1.default;
|
|
32
34
|
const mergePoints_1 = __importDefault(require("./mergePoints"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/contours/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAA4C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/contours/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAAwD;AAWtD,8BAXK,6BAAmB,CAWL;AAVrB,oEAA4C;AAW1C,wBAXK,uBAAa,CAWL;AAVf,gEAAwC;AAWtC,sBAXK,qBAAW,CAWL;AAVb,8EAAsD;AAWpD,6BAXK,4BAAkB,CAWL;AAVpB,uFAAoF;AAWlF,gHAXO,iEAA+B,OAWP;AAVjC,oFAA4D;AAW1D,gCAXK,+BAAqB,CAWL;AAVvB,0HAAkG;AAYhG,4CAZK,2CAAiC,CAYL;AAXnC,+DAAiD;AAU/C,sCAAa;AATf,wFAAgE;AAW9D,kCAXK,iCAAuB,CAWL"}
|
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const polyline_1 = require("../math/polyline");
|
|
3
4
|
function reverseIfAntiClockwise(points, ...otherListsToReverse) {
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
6
|
-
return points;
|
|
7
|
-
}
|
|
8
|
-
let xSum = 0;
|
|
9
|
-
for (const point of points) {
|
|
10
|
-
xSum += point[0];
|
|
11
|
-
}
|
|
12
|
-
const xMean = xSum / length;
|
|
13
|
-
let checkSum = 0;
|
|
14
|
-
for (let k = 0, i = 1, j = 2; k < length; k++) {
|
|
15
|
-
checkSum += (points[i][0] - xMean) * (points[j][1] - points[k][1]);
|
|
16
|
-
i++;
|
|
17
|
-
j++;
|
|
18
|
-
if (i >= length) {
|
|
19
|
-
i = 0;
|
|
20
|
-
}
|
|
21
|
-
if (j >= length) {
|
|
22
|
-
j = 0;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (checkSum < 0) {
|
|
5
|
+
const signedArea = (0, polyline_1.getSignedArea)(points);
|
|
6
|
+
if (signedArea < 0) {
|
|
26
7
|
if (otherListsToReverse) {
|
|
27
8
|
otherListsToReverse.forEach((list) => list.reverse());
|
|
28
9
|
}
|
|
@@ -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,+CAAiD;AAWjD,SAAwB,sBAAsB,CAC5C,MAAsB,EACtB,GAAG,mBAAgC;IAEnC,MAAM,UAAU,GAAG,IAAA,wBAAa,EAAC,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;AAhBD,yCAgBC"}
|
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.distanceToPointSquared = exports.distanceToPoint = void 0;
|
|
6
|
+
exports.distanceToPointSquared = exports.distanceToPoint = exports.intersectAABB = void 0;
|
|
7
|
+
var intersectAABB_1 = require("./intersectAABB");
|
|
8
|
+
Object.defineProperty(exports, "intersectAABB", { enumerable: true, get: function () { return __importDefault(intersectAABB_1).default; } });
|
|
7
9
|
var distanceToPoint_1 = require("./distanceToPoint");
|
|
8
10
|
Object.defineProperty(exports, "distanceToPoint", { enumerable: true, get: function () { return __importDefault(distanceToPoint_1).default; } });
|
|
9
11
|
var distanceToPointSquared_1 = require("./distanceToPointSquared");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utilities/math/aabb/index.ts"],"names":[],"mappings":";;;;;;AAAA,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,mEAA6E;AAApE,iJAAA,OAAO,OAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utilities/math/aabb/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB;AACjC,qDAA+D;AAAtD,mIAAA,OAAO,OAAmB;AACnC,mEAA6E;AAApE,iJAAA,OAAO,OAA0B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function intersectAABB(aabb1, aabb2) {
|
|
4
|
+
return (aabb1.minX <= aabb2.maxX &&
|
|
5
|
+
aabb1.maxX >= aabb2.minX &&
|
|
6
|
+
aabb1.minY <= aabb2.maxY &&
|
|
7
|
+
aabb1.maxY >= aabb2.minY);
|
|
8
|
+
}
|
|
9
|
+
exports.default = intersectAABB;
|
|
10
|
+
//# sourceMappingURL=intersectAABB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersectAABB.js","sourceRoot":"","sources":["../../../../../src/utilities/math/aabb/intersectAABB.ts"],"names":[],"mappings":";;AAQA,SAAwB,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;AAVD,gCAUC"}
|
|
@@ -6,7 +6,10 @@ function distanceToPointSquared(p1, p2) {
|
|
|
6
6
|
}
|
|
7
7
|
const [x1, y1, z1 = 0] = p1;
|
|
8
8
|
const [x2, y2, z2 = 0] = p2;
|
|
9
|
-
|
|
9
|
+
const dx = x2 - x1;
|
|
10
|
+
const dy = y2 - y1;
|
|
11
|
+
const dz = z2 - z1;
|
|
12
|
+
return dx * dx + dy * dy + dz * dz;
|
|
10
13
|
}
|
|
11
14
|
exports.default = distanceToPointSquared;
|
|
12
15
|
//# sourceMappingURL=distanceToPointSquared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distanceToPointSquared.js","sourceRoot":"","sources":["../../../../../src/utilities/math/point/distanceToPointSquared.ts"],"names":[],"mappings":";;AAWA,SAAwB,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,SAAwB,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;AAdD,yCAcC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function areLineSegmentsIntersecting(p1, q1, p2, q2) {
|
|
4
|
+
let result = false;
|
|
5
|
+
const line1MinX = p1[0] < q1[0] ? p1[0] : q1[0];
|
|
6
|
+
const line1MinY = p1[1] < q1[1] ? p1[1] : q1[1];
|
|
7
|
+
const line1MaxX = p1[0] > q1[0] ? p1[0] : q1[0];
|
|
8
|
+
const line1MaxY = p1[1] > q1[1] ? p1[1] : q1[1];
|
|
9
|
+
const line2MinX = p2[0] < q2[0] ? p2[0] : q2[0];
|
|
10
|
+
const line2MinY = p2[1] < q2[1] ? p2[1] : q2[1];
|
|
11
|
+
const line2MaxX = p2[0] > q2[0] ? p2[0] : q2[0];
|
|
12
|
+
const line2MaxY = p2[1] > q2[1] ? p2[1] : q2[1];
|
|
13
|
+
if (line1MinX > line2MaxX ||
|
|
14
|
+
line1MaxX < line2MinX ||
|
|
15
|
+
line1MinY > line2MaxY ||
|
|
16
|
+
line1MaxY < line2MinY) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const orient = [
|
|
20
|
+
orientation(p1, q1, p2),
|
|
21
|
+
orientation(p1, q1, q2),
|
|
22
|
+
orientation(p2, q2, p1),
|
|
23
|
+
orientation(p2, q2, q1),
|
|
24
|
+
];
|
|
25
|
+
if (orient[0] !== orient[1] && orient[2] !== orient[3]) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (orient[0] === 0 && onSegment(p1, p2, q1)) {
|
|
29
|
+
result = true;
|
|
30
|
+
}
|
|
31
|
+
else if (orient[1] === 0 && onSegment(p1, q2, q1)) {
|
|
32
|
+
result = true;
|
|
33
|
+
}
|
|
34
|
+
else if (orient[2] === 0 && onSegment(p2, p1, q2)) {
|
|
35
|
+
result = true;
|
|
36
|
+
}
|
|
37
|
+
else if (orient[3] === 0 && onSegment(p2, q1, q2)) {
|
|
38
|
+
result = true;
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
exports.default = areLineSegmentsIntersecting;
|
|
43
|
+
function orientation(p, q, r) {
|
|
44
|
+
const orientationValue = (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1]);
|
|
45
|
+
if (orientationValue === 0) {
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
return orientationValue > 0 ? 1 : 2;
|
|
49
|
+
}
|
|
50
|
+
function onSegment(p, q, r) {
|
|
51
|
+
if (q[0] <= Math.max(p[0], r[0]) &&
|
|
52
|
+
q[0] >= Math.min(p[0], r[0]) &&
|
|
53
|
+
q[1] <= Math.max(p[1], r[1]) &&
|
|
54
|
+
q[1] >= Math.min(p[1], r[1])) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=areLineSegmentsIntersecting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areLineSegmentsIntersecting.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/areLineSegmentsIntersecting.ts"],"names":[],"mappings":";;AAsBA,SAAwB,2BAA2B,CACjD,EAAgB,EAChB,EAAgB,EAChB,EAAgB,EAChB,EAAgB;IAEhB,IAAI,MAAM,GAA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 -0,0 +1,4 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
declare function mergePolylines(targetPolyline: Types.Point2[], sourcePolyline: Types.Point2[]): Types.Point2[];
|
|
3
|
+
declare function subtractPolylines(targetPolyline: Types.Point2[], sourcePolyline: Types.Point2[]): Types.Point2[][];
|
|
4
|
+
export { mergePolylines, subtractPolylines };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.subtractPolylines = exports.mergePolylines = void 0;
|
|
30
|
+
const mathPoint = __importStar(require("../point"));
|
|
31
|
+
const getLineSegmentIntersectionsIndexes_1 = __importDefault(require("./getLineSegmentIntersectionsIndexes"));
|
|
32
|
+
const containsPoint_1 = __importDefault(require("./containsPoint"));
|
|
33
|
+
const getNormal2_1 = __importDefault(require("./getNormal2"));
|
|
34
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
35
|
+
const getLineSegmentsIntersection_1 = __importDefault(require("./getLineSegmentsIntersection"));
|
|
36
|
+
var PolylinePointType;
|
|
37
|
+
(function (PolylinePointType) {
|
|
38
|
+
PolylinePointType[PolylinePointType["Vertex"] = 0] = "Vertex";
|
|
39
|
+
PolylinePointType[PolylinePointType["Intersection"] = 1] = "Intersection";
|
|
40
|
+
})(PolylinePointType || (PolylinePointType = {}));
|
|
41
|
+
var PolylinePointPosition;
|
|
42
|
+
(function (PolylinePointPosition) {
|
|
43
|
+
PolylinePointPosition[PolylinePointPosition["Outside"] = -1] = "Outside";
|
|
44
|
+
PolylinePointPosition[PolylinePointPosition["Edge"] = 0] = "Edge";
|
|
45
|
+
PolylinePointPosition[PolylinePointPosition["Inside"] = 1] = "Inside";
|
|
46
|
+
})(PolylinePointPosition || (PolylinePointPosition = {}));
|
|
47
|
+
var PolylinePointDirection;
|
|
48
|
+
(function (PolylinePointDirection) {
|
|
49
|
+
PolylinePointDirection[PolylinePointDirection["Exiting"] = -1] = "Exiting";
|
|
50
|
+
PolylinePointDirection[PolylinePointDirection["Unknown"] = 0] = "Unknown";
|
|
51
|
+
PolylinePointDirection[PolylinePointDirection["Entering"] = 1] = "Entering";
|
|
52
|
+
})(PolylinePointDirection || (PolylinePointDirection = {}));
|
|
53
|
+
function ensuresNextPointers(polylinePoints) {
|
|
54
|
+
for (let i = 0, len = polylinePoints.length; i < len; i++) {
|
|
55
|
+
const currentPoint = polylinePoints[i];
|
|
56
|
+
if (!currentPoint.next) {
|
|
57
|
+
currentPoint.next = polylinePoints[i === len - 1 ? 0 : i + 1];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function getSourceAndTargetPointsList(targetPolyline, sourcePolyline) {
|
|
62
|
+
const targetPolylinePoints = [];
|
|
63
|
+
const sourcePolylinePoints = [];
|
|
64
|
+
const sourceIntersectionsCache = new Map();
|
|
65
|
+
const isFisrtPointInside = (0, containsPoint_1.default)(sourcePolyline, targetPolyline[0]);
|
|
66
|
+
let intersectionPointDirection = isFisrtPointInside
|
|
67
|
+
? PolylinePointDirection.Exiting
|
|
68
|
+
: PolylinePointDirection.Entering;
|
|
69
|
+
for (let i = 0, len = targetPolyline.length; i < len; i++) {
|
|
70
|
+
const p1 = targetPolyline[i];
|
|
71
|
+
const pointInside = (0, containsPoint_1.default)(sourcePolyline, p1);
|
|
72
|
+
const vertexPoint = {
|
|
73
|
+
type: PolylinePointType.Vertex,
|
|
74
|
+
coordinates: p1,
|
|
75
|
+
position: pointInside
|
|
76
|
+
? PolylinePointPosition.Inside
|
|
77
|
+
: PolylinePointPosition.Outside,
|
|
78
|
+
visited: false,
|
|
79
|
+
next: null,
|
|
80
|
+
};
|
|
81
|
+
targetPolylinePoints.push(vertexPoint);
|
|
82
|
+
const q1 = targetPolyline[i === len - 1 ? 0 : i + 1];
|
|
83
|
+
const intersectionsInfo = (0, getLineSegmentIntersectionsIndexes_1.default)(sourcePolyline, p1, q1).map((intersectedLineSegment) => {
|
|
84
|
+
const sourceLineSegmentId = intersectedLineSegment[0];
|
|
85
|
+
const p2 = sourcePolyline[intersectedLineSegment[0]];
|
|
86
|
+
const q2 = sourcePolyline[intersectedLineSegment[1]];
|
|
87
|
+
const intersectionCoordinate = (0, getLineSegmentsIntersection_1.default)(p1, q1, p2, q2);
|
|
88
|
+
const targetStartPointDistSquared = mathPoint.distanceToPointSquared(p1, intersectionCoordinate);
|
|
89
|
+
return {
|
|
90
|
+
sourceLineSegmentId,
|
|
91
|
+
coordinate: intersectionCoordinate,
|
|
92
|
+
targetStartPointDistSquared,
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
intersectionsInfo.sort((left, right) => left.targetStartPointDistSquared - right.targetStartPointDistSquared);
|
|
96
|
+
intersectionsInfo.forEach((intersectionInfo) => {
|
|
97
|
+
const { sourceLineSegmentId, coordinate: intersectionCoordinate } = intersectionInfo;
|
|
98
|
+
const targetEdgePoint = {
|
|
99
|
+
type: PolylinePointType.Intersection,
|
|
100
|
+
coordinates: intersectionCoordinate,
|
|
101
|
+
position: PolylinePointPosition.Edge,
|
|
102
|
+
direction: intersectionPointDirection,
|
|
103
|
+
visited: false,
|
|
104
|
+
next: null,
|
|
105
|
+
};
|
|
106
|
+
const sourceEdgePoint = Object.assign(Object.assign({}, targetEdgePoint), { direction: PolylinePointDirection.Unknown, cloned: true });
|
|
107
|
+
if (intersectionPointDirection === PolylinePointDirection.Entering) {
|
|
108
|
+
targetEdgePoint.next = sourceEdgePoint;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
sourceEdgePoint.next = targetEdgePoint;
|
|
112
|
+
}
|
|
113
|
+
let sourceIntersectionPoints = sourceIntersectionsCache.get(sourceLineSegmentId);
|
|
114
|
+
if (!sourceIntersectionPoints) {
|
|
115
|
+
sourceIntersectionPoints = [];
|
|
116
|
+
sourceIntersectionsCache.set(sourceLineSegmentId, sourceIntersectionPoints);
|
|
117
|
+
}
|
|
118
|
+
targetPolylinePoints.push(targetEdgePoint);
|
|
119
|
+
sourceIntersectionPoints.push(sourceEdgePoint);
|
|
120
|
+
intersectionPointDirection *= -1;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
for (let i = 0, len = sourcePolyline.length; i < len; i++) {
|
|
124
|
+
const lineSegmentId = i;
|
|
125
|
+
const p1 = sourcePolyline[i];
|
|
126
|
+
const vertexPoint = {
|
|
127
|
+
type: PolylinePointType.Vertex,
|
|
128
|
+
coordinates: p1,
|
|
129
|
+
visited: false,
|
|
130
|
+
next: null,
|
|
131
|
+
};
|
|
132
|
+
sourcePolylinePoints.push(vertexPoint);
|
|
133
|
+
const sourceIntersectionPoints = sourceIntersectionsCache.get(lineSegmentId);
|
|
134
|
+
if (!(sourceIntersectionPoints === null || sourceIntersectionPoints === void 0 ? void 0 : sourceIntersectionPoints.length)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
sourceIntersectionPoints
|
|
138
|
+
.map((intersectionPoint) => ({
|
|
139
|
+
intersectionPoint,
|
|
140
|
+
lineSegStartDistSquared: mathPoint.distanceToPointSquared(p1, intersectionPoint.coordinates),
|
|
141
|
+
}))
|
|
142
|
+
.sort((left, right) => left.lineSegStartDistSquared - right.lineSegStartDistSquared)
|
|
143
|
+
.map(({ intersectionPoint }) => intersectionPoint)
|
|
144
|
+
.forEach((intersectionPoint) => sourcePolylinePoints.push(intersectionPoint));
|
|
145
|
+
}
|
|
146
|
+
ensuresNextPointers(targetPolylinePoints);
|
|
147
|
+
ensuresNextPointers(sourcePolylinePoints);
|
|
148
|
+
return { targetPolylinePoints, sourcePolylinePoints };
|
|
149
|
+
}
|
|
150
|
+
function getUnvisitedOutsidePoint(polylinePoints) {
|
|
151
|
+
for (let i = 0, len = polylinePoints.length; i < len; i++) {
|
|
152
|
+
const point = polylinePoints[i];
|
|
153
|
+
if (!point.visited && point.position === PolylinePointPosition.Outside) {
|
|
154
|
+
return point;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function mergePolylines(targetPolyline, sourcePolyline) {
|
|
159
|
+
const targetNormal = (0, getNormal2_1.default)(targetPolyline);
|
|
160
|
+
const sourceNormal = (0, getNormal2_1.default)(sourcePolyline);
|
|
161
|
+
const dotNormals = gl_matrix_1.vec3.dot(sourceNormal, targetNormal);
|
|
162
|
+
if (!gl_matrix_1.glMatrix.equals(1, dotNormals)) {
|
|
163
|
+
sourcePolyline = sourcePolyline.slice().reverse();
|
|
164
|
+
}
|
|
165
|
+
const { targetPolylinePoints } = getSourceAndTargetPointsList(targetPolyline, sourcePolyline);
|
|
166
|
+
const startPoint = getUnvisitedOutsidePoint(targetPolylinePoints);
|
|
167
|
+
if (!startPoint) {
|
|
168
|
+
return targetPolyline.slice();
|
|
169
|
+
}
|
|
170
|
+
const mergedPolyline = [startPoint.coordinates];
|
|
171
|
+
let currentPoint = startPoint.next;
|
|
172
|
+
while (currentPoint !== startPoint) {
|
|
173
|
+
if (currentPoint.type === PolylinePointType.Intersection &&
|
|
174
|
+
currentPoint.cloned) {
|
|
175
|
+
currentPoint = currentPoint.next;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
mergedPolyline.push(currentPoint.coordinates);
|
|
179
|
+
currentPoint = currentPoint.next;
|
|
180
|
+
}
|
|
181
|
+
return mergedPolyline;
|
|
182
|
+
}
|
|
183
|
+
exports.mergePolylines = mergePolylines;
|
|
184
|
+
function subtractPolylines(targetPolyline, sourcePolyline) {
|
|
185
|
+
const targetNormal = (0, getNormal2_1.default)(targetPolyline);
|
|
186
|
+
const sourceNormal = (0, getNormal2_1.default)(sourcePolyline);
|
|
187
|
+
const dotNormals = gl_matrix_1.vec3.dot(sourceNormal, targetNormal);
|
|
188
|
+
if (!gl_matrix_1.glMatrix.equals(-1, dotNormals)) {
|
|
189
|
+
sourcePolyline = sourcePolyline.slice().reverse();
|
|
190
|
+
}
|
|
191
|
+
const { targetPolylinePoints } = getSourceAndTargetPointsList(targetPolyline, sourcePolyline);
|
|
192
|
+
let startPoint = null;
|
|
193
|
+
const subtractedPolylines = [];
|
|
194
|
+
while ((startPoint = getUnvisitedOutsidePoint(targetPolylinePoints))) {
|
|
195
|
+
const subtractedPolyline = [startPoint.coordinates];
|
|
196
|
+
let currentPoint = startPoint.next;
|
|
197
|
+
startPoint.visited = true;
|
|
198
|
+
while (currentPoint !== startPoint) {
|
|
199
|
+
currentPoint.visited = true;
|
|
200
|
+
if (currentPoint.type === PolylinePointType.Intersection &&
|
|
201
|
+
currentPoint.cloned) {
|
|
202
|
+
currentPoint = currentPoint.next;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
subtractedPolyline.push(currentPoint.coordinates);
|
|
206
|
+
currentPoint = currentPoint.next;
|
|
207
|
+
}
|
|
208
|
+
subtractedPolylines.push(subtractedPolyline);
|
|
209
|
+
}
|
|
210
|
+
return subtractedPolylines;
|
|
211
|
+
}
|
|
212
|
+
exports.subtractPolylines = subtractPolylines;
|
|
213
|
+
//# sourceMappingURL=combinePolyline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combinePolyline.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/combinePolyline.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAsC;AACtC,8GAAsF;AACtF,oEAA4C;AAC5C,8DAAsC;AACtC,yCAA2C;AAC3C,gGAAwE;AAExE,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,6DAAM,CAAA;IACN,yEAAY,CAAA;AACd,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAGD,IAAK,qBAIJ;AAJD,WAAK,qBAAqB;IACxB,wEAAY,CAAA;IACZ,iEAAQ,CAAA;IACR,qEAAU,CAAA;AACZ,CAAC,EAJI,qBAAqB,KAArB,qBAAqB,QAIzB;AAID,IAAK,sBAIJ;AAJD,WAAK,sBAAsB;IACzB,0EAAY,CAAA;IACZ,yEAAW,CAAA;IACX,2EAAY,CAAA;AACd,CAAC,EAJI,sBAAsB,KAAtB,sBAAsB,QAI1B;AAoBD,SAAS,mBAAmB,CAAC,cAA+B;IAE1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QACzD,MAAM,YAAY,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;QAEvC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;YACtB,YAAY,C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AI,CAAC;IACrC,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAE/B,OAAO,CAAC,UAAU,GAAG,wBAAwB,CAAC,oBAAoB,CAAC,CAAC,EAAE;QACpE,MAAM,kBAAkB,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC;QAEnC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;QAE1B,OAAO,YAAY,KAAK,UAAU,EAAE;YAClC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;YAE5B,IACE,YAAY,CAAC,IAAI,KAAK,iBAAiB,CAAC,YAAY;gBACxB,YAAa,CAAC,MAAM,EAChD;gBACA,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC;gBACjC,SAAS;aACV;YAED,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,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;AAEwB,8CAAiB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const isClosed_1 = __importDefault(require("./isClosed"));
|
|
7
|
+
function containsPoint(polyline, point, closed) {
|
|
8
|
+
if (polyline.length < 3) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const numPolylinePoints = polyline.length;
|
|
12
|
+
let numIntersections = 0;
|
|
13
|
+
const shouldClose = !(closed === undefined ? (0, isClosed_1.default)(polyline) : closed);
|
|
14
|
+
const maxSegmentIndex = polyline.length - (shouldClose ? 1 : 2);
|
|
15
|
+
for (let i = 0; i <= maxSegmentIndex; i++) {
|
|
16
|
+
const p1 = polyline[i];
|
|
17
|
+
const p2Index = i === numPolylinePoints - 1 ? 0 : i + 1;
|
|
18
|
+
const p2 = polyline[p2Index];
|
|
19
|
+
const maxX = p1[0] >= p2[0] ? p1[0] : p2[0];
|
|
20
|
+
const maxY = p1[1] >= p2[1] ? p1[1] : p2[1];
|
|
21
|
+
const minY = p1[1] <= p2[1] ? p1[1] : p2[1];
|
|
22
|
+
const mayIntersectLineSegment = point[0] <= maxX && point[1] >= minY && point[1] < maxY;
|
|
23
|
+
if (mayIntersectLineSegment) {
|
|
24
|
+
const isVerticalLine = p1[0] === p2[0];
|
|
25
|
+
let intersects = isVerticalLine;
|
|
26
|
+
if (!intersects) {
|
|
27
|
+
const xIntersection = ((point[1] - p1[1]) * (p2[0] - p1[0])) / (p2[1] - p1[1]) + p1[0];
|
|
28
|
+
intersects = point[0] <= xIntersection;
|
|
29
|
+
}
|
|
30
|
+
numIntersections += intersects ? 1 : 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return !!(numIntersections % 2);
|
|
34
|
+
}
|
|
35
|
+
exports.default = containsPoint;
|
|
36
|
+
//# sourceMappingURL=containsPoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containsPoint.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/containsPoint.ts"],"names":[],"mappings":";;;;;AACA,0DAAkC;AAalC,SAAwB,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,IAAA,kBAAQ,EAAC,QAAQ,CAA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E,CAAC,CAAC,CAAC,CAAC;YACvC,IAAI,UAAU,GAAG,cAAc,CAAC;YAEhC,IAAI,CAAC,UAAU,EAAE;gBACf,MAAM,aAAa,GACjB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;gBAEnE,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC;aACxC;YAED,gBAAgB,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxC;KACF;IAED,OAAO,CAAC,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AAhDD,gCAgDC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function getAABB(polyline) {
|
|
4
|
+
let minX = Infinity;
|
|
5
|
+
let minY = Infinity;
|
|
6
|
+
let maxX = -Infinity;
|
|
7
|
+
let maxY = -Infinity;
|
|
8
|
+
for (let i = 0, len = polyline.length; i < len; i++) {
|
|
9
|
+
const [x, y] = polyline[i];
|
|
10
|
+
minX = minX < x ? minX : x;
|
|
11
|
+
minY = minY < y ? minY : y;
|
|
12
|
+
maxX = maxX > x ? maxX : x;
|
|
13
|
+
maxY = maxY > y ? maxY : y;
|
|
14
|
+
}
|
|
15
|
+
return { minX, maxX, minY, maxY };
|
|
16
|
+
}
|
|
17
|
+
exports.default = getAABB;
|
|
18
|
+
//# sourceMappingURL=getAABB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAABB.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getAABB.ts"],"names":[],"mappings":";;AAEA,SAAwB,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;AAjBD,0BAiBC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function
|
|
3
|
+
function getArea(points) {
|
|
4
4
|
const n = points.length;
|
|
5
5
|
let area = 0.0;
|
|
6
6
|
let j = n - 1;
|
|
@@ -10,5 +10,5 @@ function calculateAreaOfPoints(points) {
|
|
|
10
10
|
}
|
|
11
11
|
return Math.abs(area / 2.0);
|
|
12
12
|
}
|
|
13
|
-
exports.default =
|
|
14
|
-
//# sourceMappingURL=
|
|
13
|
+
exports.default = getArea;
|
|
14
|
+
//# sourceMappingURL=getArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArea.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getArea.ts"],"names":[],"mappings":";;AASA,SAAwB,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;AAbD,0BAaC"}
|