@cornerstonejs/tools 1.50.3 → 1.51.0
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,53 @@
|
|
|
1
|
+
import { vec3 } from 'gl-matrix';
|
|
2
|
+
import { Types } from '@cornerstonejs/core';
|
|
3
|
+
|
|
4
|
+
function _getAreaVector(polyline: Types.Point3[]): Types.Point3 {
|
|
5
|
+
const vecArea = vec3.create();
|
|
6
|
+
|
|
7
|
+
// Reference point can be any point on the same plane
|
|
8
|
+
const refPoint = polyline[0];
|
|
9
|
+
|
|
10
|
+
// Takes three points, reference point and two other points from each line
|
|
11
|
+
// segment, and calculate the area with cross product. The magnitude of the
|
|
12
|
+
// vector returned by a cross product is equal to the area of the parallelogram
|
|
13
|
+
// that the vectors span which is two times the area of the triangle.
|
|
14
|
+
//
|
|
15
|
+
// Not calling vec3 mathods makes the function run much faster since polylines
|
|
16
|
+
// may have thousands of points when using freehand ROI tool and that would
|
|
17
|
+
// increase considerably the number of function calls.
|
|
18
|
+
for (let i = 0, len = polyline.length; i < len; i++) {
|
|
19
|
+
const p1 = polyline[i];
|
|
20
|
+
// Using ternary instead of % (mod) operator to make it faster
|
|
21
|
+
const p2Index = i === len - 1 ? 0 : i + 1;
|
|
22
|
+
const p2 = polyline[p2Index];
|
|
23
|
+
|
|
24
|
+
const aX = p1[0] - refPoint[0];
|
|
25
|
+
const aY = p1[1] - refPoint[1];
|
|
26
|
+
const aZ = p1[2] - refPoint[2];
|
|
27
|
+
const bX = p2[0] - refPoint[0];
|
|
28
|
+
const bY = p2[1] - refPoint[1];
|
|
29
|
+
const bZ = p2[2] - refPoint[2];
|
|
30
|
+
|
|
31
|
+
// Cross product without calling vec3.cross() for better performance
|
|
32
|
+
vecArea[0] += aY * bZ - aZ * bY;
|
|
33
|
+
vecArea[1] += aZ * bX - aX * bZ;
|
|
34
|
+
vecArea[2] += aX * bY - aY * bX;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Divide by two because cross product returns two times the area for each triangle
|
|
38
|
+
vec3.scale(vecArea, vecArea, 0.5);
|
|
39
|
+
|
|
40
|
+
// The magnitude of the vector is the area of the polyline
|
|
41
|
+
return <Types.Point3>vecArea;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Calculate the normal of a 3D planar polyline
|
|
46
|
+
* @param polyline - Planar polyline in 3D space
|
|
47
|
+
* @returns Normal of the 3D planar polyline
|
|
48
|
+
*/
|
|
49
|
+
export default function getNormal3(polyline: Types.Point3[]): Types.Point3 {
|
|
50
|
+
const vecArea = _getAreaVector(polyline);
|
|
51
|
+
|
|
52
|
+
return vec3.normalize(vecArea, vecArea) as Types.Point3;
|
|
53
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the area with signal of a 2D polyline
|
|
5
|
+
* https://www.youtube.com/watch?v=GpsKrAipXm8&t=1900s
|
|
6
|
+
*
|
|
7
|
+
* This functions has a runtime very close to `getArea` and it is recommended to
|
|
8
|
+
* be called only if you need the area signal (eg: calculate polygon normal). If
|
|
9
|
+
* you do not need the area signal you should always call `getArea`.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @param polyline - Polyline points (2D)
|
|
13
|
+
* @returns Area of the polyline (with signal)
|
|
14
|
+
*/
|
|
15
|
+
export default function getSignedArea(polyline: Types.Point2[]): number {
|
|
16
|
+
// Reference point can be any point on the same plane
|
|
17
|
+
const refPoint = polyline[0];
|
|
18
|
+
let area = 0;
|
|
19
|
+
|
|
20
|
+
// Takes three points (reference point and two other points from each line
|
|
21
|
+
// segment) and calculate the area with cross product. The magnitude of the
|
|
22
|
+
// vector returned by a cross product is equal to the area of the parallelogram
|
|
23
|
+
// that the vectors span which is two times the area of the triangle.
|
|
24
|
+
//
|
|
25
|
+
// Not calling vec3 mathods makes the function run much faster since polylines
|
|
26
|
+
// may have thousands of points when using freehand ROI tool and that would
|
|
27
|
+
// increase considerably the number of function calls.
|
|
28
|
+
for (let i = 0, len = polyline.length; i < len; i++) {
|
|
29
|
+
const p1 = polyline[i];
|
|
30
|
+
// Using ternary instead of % (mod) operator to make it faster
|
|
31
|
+
const p2Index = i === len - 1 ? 0 : i + 1;
|
|
32
|
+
const p2 = polyline[p2Index];
|
|
33
|
+
const aX = p1[0] - refPoint[0];
|
|
34
|
+
const aY = p1[1] - refPoint[1];
|
|
35
|
+
const bX = p2[0] - refPoint[0];
|
|
36
|
+
const bY = p2[1] - refPoint[1];
|
|
37
|
+
|
|
38
|
+
// Cross product between vectors "a" and "b" which returns (0, 0, crossProd)
|
|
39
|
+
// for 2D vectors.
|
|
40
|
+
area += aX * bY - aY * bX;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Divide by two because cross product returns two times the area for each triangle
|
|
44
|
+
area *= 0.5;
|
|
45
|
+
|
|
46
|
+
return area;
|
|
47
|
+
}
|
|
@@ -1,19 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import isClosed from './isClosed';
|
|
2
|
+
import containsPoint from './containsPoint';
|
|
3
|
+
import getAABB from './getAABB';
|
|
4
|
+
import getArea from './getArea';
|
|
5
|
+
import getSignedArea from './getSignedArea';
|
|
6
|
+
import getNormal3 from './getNormal3';
|
|
7
|
+
import getNormal2 from './getNormal2';
|
|
8
|
+
import { mergePolylines, subtractPolylines } from './combinePolyline';
|
|
9
|
+
import intersectPolyline from './intersectPolyline';
|
|
10
|
+
import getFirstLineSegmentIntersectionIndexes from './getFirstLineSegmentIntersectionIndexes';
|
|
11
|
+
import getLineSegmentIntersectionsIndexes from './getLineSegmentIntersectionsIndexes';
|
|
12
|
+
import getLineSegmentIntersectionsCoordinates from './getLineSegmentIntersectionsCoordinates';
|
|
13
|
+
import getClosestLineSegmentIntersection from './getClosestLineSegmentIntersection';
|
|
5
14
|
import getSubPixelSpacingAndXYDirections from './getSubPixelSpacingAndXYDirections';
|
|
6
15
|
import pointsAreWithinCloseContourProximity from './pointsAreWithinCloseContourProximity';
|
|
7
16
|
import addCanvasPointsToArray from './addCanvasPointsToArray';
|
|
8
17
|
import pointCanProjectOnLine from './pointCanProjectOnLine';
|
|
9
|
-
import calculateAreaOfPoints from './calculateAreaOfPoints';
|
|
10
18
|
|
|
11
19
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
isClosed,
|
|
21
|
+
containsPoint,
|
|
22
|
+
getAABB,
|
|
23
|
+
getArea,
|
|
24
|
+
getSignedArea,
|
|
25
|
+
getNormal3,
|
|
26
|
+
getNormal2,
|
|
27
|
+
intersectPolyline,
|
|
28
|
+
getFirstLineSegmentIntersectionIndexes,
|
|
29
|
+
getLineSegmentIntersectionsIndexes,
|
|
30
|
+
getLineSegmentIntersectionsCoordinates,
|
|
31
|
+
getClosestLineSegmentIntersection,
|
|
14
32
|
getSubPixelSpacingAndXYDirections,
|
|
15
33
|
pointsAreWithinCloseContourProximity,
|
|
16
34
|
addCanvasPointsToArray,
|
|
17
35
|
pointCanProjectOnLine,
|
|
18
|
-
|
|
36
|
+
mergePolylines,
|
|
37
|
+
subtractPolylines,
|
|
19
38
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Types } from '@cornerstonejs/core';
|
|
2
|
+
import getFirstLineSegmentIntersectionIndexes from './getFirstLineSegmentIntersectionIndexes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Check if two polylines intersect comparing line segment by line segment.
|
|
6
|
+
* @param sourcePolyline - Source polyline
|
|
7
|
+
* @param targetPolyline - Target polyline
|
|
8
|
+
* @returns True if the polylines intersect or false otherwise
|
|
9
|
+
*/
|
|
10
|
+
export default function intersectPolyline(
|
|
11
|
+
sourcePolyline: Types.Point2[],
|
|
12
|
+
targetPolyline: Types.Point2[]
|
|
13
|
+
): boolean {
|
|
14
|
+
// Naive way to detect intersection between polylines in O(n^2).
|
|
15
|
+
// TODO: Implement Bentley Ottmann sweep line algorithm or maybe some
|
|
16
|
+
// algorithm that uses r-tree may make it run faster
|
|
17
|
+
for (let i = 0, sourceLen = sourcePolyline.length; i < sourceLen; i++) {
|
|
18
|
+
const sourceP1 = sourcePolyline[i];
|
|
19
|
+
const sourceP2Index = i === sourceLen - 1 ? 0 : i + 1;
|
|
20
|
+
const sourceP2 = sourcePolyline[sourceP2Index];
|
|
21
|
+
|
|
22
|
+
const intersectionPointIndexes = getFirstLineSegmentIntersectionIndexes(
|
|
23
|
+
targetPolyline,
|
|
24
|
+
sourceP1,
|
|
25
|
+
sourceP2
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (intersectionPointIndexes?.length === 2) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { glMatrix } from 'gl-matrix';
|
|
2
|
+
import type { Types } from '@cornerstonejs/core';
|
|
3
|
+
import * as math from '..';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A polyline is considered closed if the start and end points are at the same position
|
|
7
|
+
*
|
|
8
|
+
* @param polyline - Polyline points (2D)
|
|
9
|
+
* @returns True if the polyline is already closed or false otherwise
|
|
10
|
+
*/
|
|
11
|
+
export default function isClosed(polyline: Types.Point2[]): boolean {
|
|
12
|
+
if (polyline.length < 3) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const numPolylinePoints = polyline.length;
|
|
17
|
+
|
|
18
|
+
const firstPoint = polyline[0];
|
|
19
|
+
const lastPoint = polyline[numPolylinePoints - 1];
|
|
20
|
+
const distFirstToLastPoints = math.point.distanceToPointSquared(
|
|
21
|
+
firstPoint,
|
|
22
|
+
lastPoint
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return glMatrix.equals(0, distFirstToLastPoints);
|
|
26
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calculateAreaOfPoints.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/calculateAreaOfPoints.ts"],"names":[],"mappings":";;AASA,SAAwB,qBAAqB,CAAC,MAAsB;IAElE,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,wCAaC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Types } from '@cornerstonejs/core';
|
|
2
|
-
declare function getAllIntersectionsWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): Types.Point2[];
|
|
3
|
-
declare function getIntersectionCoordinatesWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): Types.Point2[];
|
|
4
|
-
declare function getFirstIntersectionWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): Types.Point2 | undefined;
|
|
5
|
-
declare function getClosestIntersectionWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): {
|
|
6
|
-
segment: Types.Point2;
|
|
7
|
-
distance: number;
|
|
8
|
-
} | undefined;
|
|
9
|
-
export { getAllIntersectionsWithPolyline, getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline, getIntersectionCoordinatesWithPolyline, };
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIntersectionCoordinatesWithPolyline = exports.getClosestIntersectionWithPolyline = exports.getFirstIntersectionWithPolyline = exports.getAllIntersectionsWithPolyline = void 0;
|
|
4
|
-
const gl_matrix_1 = require("gl-matrix");
|
|
5
|
-
function getAllIntersectionsWithPolyline(points, p1, q1, closed = true) {
|
|
6
|
-
let initialI;
|
|
7
|
-
let j;
|
|
8
|
-
const intersections = [];
|
|
9
|
-
if (closed) {
|
|
10
|
-
j = points.length - 1;
|
|
11
|
-
initialI = 0;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
j = 0;
|
|
15
|
-
initialI = 1;
|
|
16
|
-
}
|
|
17
|
-
for (let i = initialI; i < points.length; i++) {
|
|
18
|
-
const p2 = points[j];
|
|
19
|
-
const q2 = points[i];
|
|
20
|
-
if (doesIntersect(p1, q1, p2, q2)) {
|
|
21
|
-
intersections.push([j, i]);
|
|
22
|
-
}
|
|
23
|
-
j = i;
|
|
24
|
-
}
|
|
25
|
-
return intersections;
|
|
26
|
-
}
|
|
27
|
-
exports.getAllIntersectionsWithPolyline = getAllIntersectionsWithPolyline;
|
|
28
|
-
function getIntersectionCoordinatesWithPolyline(points, p1, q1, closed = true) {
|
|
29
|
-
const result = [];
|
|
30
|
-
const polylineIndexes = getAllIntersectionsWithPolyline(points, p1, q1, closed);
|
|
31
|
-
for (let i = 0; i < polylineIndexes.length; i++) {
|
|
32
|
-
const p2 = points[polylineIndexes[i][0]];
|
|
33
|
-
const q2 = points[polylineIndexes[i][1]];
|
|
34
|
-
const intersection = getIntersection(p1, q1, p2, q2);
|
|
35
|
-
result.push(intersection);
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
exports.getIntersectionCoordinatesWithPolyline = getIntersectionCoordinatesWithPolyline;
|
|
40
|
-
function getFirstIntersectionWithPolyline(points, p1, q1, closed = true) {
|
|
41
|
-
let initialI;
|
|
42
|
-
let j;
|
|
43
|
-
if (closed) {
|
|
44
|
-
j = points.length - 1;
|
|
45
|
-
initialI = 0;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
j = 0;
|
|
49
|
-
initialI = 1;
|
|
50
|
-
}
|
|
51
|
-
for (let i = initialI; i < points.length; i++) {
|
|
52
|
-
const p2 = points[j];
|
|
53
|
-
const q2 = points[i];
|
|
54
|
-
if (doesIntersect(p1, q1, p2, q2)) {
|
|
55
|
-
return [j, i];
|
|
56
|
-
}
|
|
57
|
-
j = i;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.getFirstIntersectionWithPolyline = getFirstIntersectionWithPolyline;
|
|
61
|
-
function getClosestIntersectionWithPolyline(points, p1, q1, closed = true) {
|
|
62
|
-
let initialI;
|
|
63
|
-
let j;
|
|
64
|
-
if (closed) {
|
|
65
|
-
j = points.length - 1;
|
|
66
|
-
initialI = 0;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
j = 0;
|
|
70
|
-
initialI = 1;
|
|
71
|
-
}
|
|
72
|
-
const intersections = [];
|
|
73
|
-
for (let i = initialI; i < points.length; i++) {
|
|
74
|
-
const p2 = points[j];
|
|
75
|
-
const q2 = points[i];
|
|
76
|
-
if (doesIntersect(p1, q1, p2, q2)) {
|
|
77
|
-
intersections.push([j, i]);
|
|
78
|
-
}
|
|
79
|
-
j = i;
|
|
80
|
-
}
|
|
81
|
-
if (intersections.length === 0) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const distances = [];
|
|
85
|
-
intersections.forEach((intersection) => {
|
|
86
|
-
const intersectionPoints = [
|
|
87
|
-
points[intersection[0]],
|
|
88
|
-
points[intersection[1]],
|
|
89
|
-
];
|
|
90
|
-
const midpoint = [
|
|
91
|
-
(intersectionPoints[0][0] + intersectionPoints[1][0]) / 2,
|
|
92
|
-
(intersectionPoints[0][1] + intersectionPoints[1][1]) / 2,
|
|
93
|
-
];
|
|
94
|
-
distances.push(gl_matrix_1.vec2.distance(midpoint, p1));
|
|
95
|
-
});
|
|
96
|
-
const minDistance = Math.min(...distances);
|
|
97
|
-
const indexOfMinDistance = distances.indexOf(minDistance);
|
|
98
|
-
return {
|
|
99
|
-
segment: intersections[indexOfMinDistance],
|
|
100
|
-
distance: minDistance,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
exports.getClosestIntersectionWithPolyline = getClosestIntersectionWithPolyline;
|
|
104
|
-
function doesIntersect(p1, q1, p2, q2) {
|
|
105
|
-
let result = false;
|
|
106
|
-
const orient = [
|
|
107
|
-
orientation(p1, q1, p2),
|
|
108
|
-
orientation(p1, q1, q2),
|
|
109
|
-
orientation(p2, q2, p1),
|
|
110
|
-
orientation(p2, q2, q1),
|
|
111
|
-
];
|
|
112
|
-
if (orient[0] !== orient[1] && orient[2] !== orient[3]) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
if (orient[0] === 0 && onSegment(p1, p2, q1)) {
|
|
116
|
-
result = true;
|
|
117
|
-
}
|
|
118
|
-
else if (orient[1] === 0 && onSegment(p1, q2, q1)) {
|
|
119
|
-
result = true;
|
|
120
|
-
}
|
|
121
|
-
else if (orient[2] === 0 && onSegment(p2, p1, q2)) {
|
|
122
|
-
result = true;
|
|
123
|
-
}
|
|
124
|
-
else if (orient[3] === 0 && onSegment(p2, q1, q2)) {
|
|
125
|
-
result = true;
|
|
126
|
-
}
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
function orientation(p, q, r) {
|
|
130
|
-
const orientationValue = (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1]);
|
|
131
|
-
if (orientationValue === 0) {
|
|
132
|
-
return 0;
|
|
133
|
-
}
|
|
134
|
-
return orientationValue > 0 ? 1 : 2;
|
|
135
|
-
}
|
|
136
|
-
function onSegment(p, q, r) {
|
|
137
|
-
if (q[0] <= Math.max(p[0], r[0]) &&
|
|
138
|
-
q[0] >= Math.min(p[0], r[0]) &&
|
|
139
|
-
q[1] <= Math.max(p[1], r[1]) &&
|
|
140
|
-
q[1] >= Math.min(p[1], r[1])) {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
function getIntersection(p1, q1, p2, q2) {
|
|
146
|
-
const denominator = (q2[1] - p2[1]) * (q1[0] - p1[0]) - (q2[0] - p2[0]) * (q1[1] - p1[1]);
|
|
147
|
-
if (denominator == 0) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
let a = p1[1] - p2[1];
|
|
151
|
-
let b = p1[0] - p2[0];
|
|
152
|
-
const numerator1 = (q2[0] - p2[0]) * a - (q2[1] - p2[1]) * b;
|
|
153
|
-
const numerator2 = (q1[0] - p1[0]) * a - (q1[1] - p1[1]) * b;
|
|
154
|
-
a = numerator1 / denominator;
|
|
155
|
-
b = numerator2 / denominator;
|
|
156
|
-
const resultX = p1[0] + a * (q1[0] - p1[0]);
|
|
157
|
-
const resultY = p1[1] + a * (q1[1] - p1[1]);
|
|
158
|
-
return [resultX, resultY];
|
|
159
|
-
}
|
|
160
|
-
//# sourceMappingURL=getIntersectionWithPolyline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getIntersectionWithPolyline.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getIntersectionWithPolyline.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AAQjC,SAAS,+BAA+B,CACtC,MAAsB,EACtB,EAAgB,EAChB,EAAgB,EAChB,MAAM,GAAG,IAAI;IAEb,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC,CAAC;IACN,MAAM,aAAa,GAAmB,EAAE,CAAC;IAEzC,IAAI,MAAM,EAAE;QACV,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACtB,QAAQ,GAAG,CAAC,CAAC;KACd;SAAM;QACL,CAAC,GAAG,CAAC,CAAC;QACN,QAAQ,G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ionWithPolyline_1 = require("./getIntersectionWithPolyline");
|
|
4
|
-
function pointInPolyline(points, point, pointEnd) {
|
|
5
|
-
const intersections = (0, getIntersectionWithPolyline_1.getAllIntersectionsWithPolyline)(points, point, [
|
|
6
|
-
point[0],
|
|
7
|
-
pointEnd[1],
|
|
8
|
-
]);
|
|
9
|
-
if (intersections.length % 2 === 0) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
exports.default = pointInPolyline;
|
|
15
|
-
//# sourceMappingURL=pointInPolyline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pointInPolyline.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/pointInPolyline.ts"],"names":[],"mappings":";;AACA,+EAAgF;AAEhF,SAAwB,eAAe,CACrC,MAAsB,EACtB,KAAmB,EACnB,QAAsB;IAEtB,MAAM,aAAa,GAAG,IAAA,6DAA+B,EAAC,MAAM,EAAE,KAAK,EAAE;QACnE,KAAK,CAAC,CAAC,CAAC;QACR,QAAQ,CAAC,CAAC,CAAC;KACZ,CAAC,CAAC;IAEH,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;QAClC,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAfD,kCAeC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calculateAreaOfPoints.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/calculateAreaOfPoints.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,MAAsB;IAElE,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"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { vec2 } from 'gl-matrix';
|
|
2
|
-
function getAllIntersectionsWithPolyline(points, p1, q1, closed = true) {
|
|
3
|
-
let initialI;
|
|
4
|
-
let j;
|
|
5
|
-
const intersections = [];
|
|
6
|
-
if (closed) {
|
|
7
|
-
j = points.length - 1;
|
|
8
|
-
initialI = 0;
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
j = 0;
|
|
12
|
-
initialI = 1;
|
|
13
|
-
}
|
|
14
|
-
for (let i = initialI; i < points.length; i++) {
|
|
15
|
-
const p2 = points[j];
|
|
16
|
-
const q2 = points[i];
|
|
17
|
-
if (doesIntersect(p1, q1, p2, q2)) {
|
|
18
|
-
intersections.push([j, i]);
|
|
19
|
-
}
|
|
20
|
-
j = i;
|
|
21
|
-
}
|
|
22
|
-
return intersections;
|
|
23
|
-
}
|
|
24
|
-
function getIntersectionCoordinatesWithPolyline(points, p1, q1, closed = true) {
|
|
25
|
-
const result = [];
|
|
26
|
-
const polylineIndexes = getAllIntersectionsWithPolyline(points, p1, q1, closed);
|
|
27
|
-
for (let i = 0; i < polylineIndexes.length; i++) {
|
|
28
|
-
const p2 = points[polylineIndexes[i][0]];
|
|
29
|
-
const q2 = points[polylineIndexes[i][1]];
|
|
30
|
-
const intersection = getIntersection(p1, q1, p2, q2);
|
|
31
|
-
result.push(intersection);
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
function getFirstIntersectionWithPolyline(points, p1, q1, closed = true) {
|
|
36
|
-
let initialI;
|
|
37
|
-
let j;
|
|
38
|
-
if (closed) {
|
|
39
|
-
j = points.length - 1;
|
|
40
|
-
initialI = 0;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
j = 0;
|
|
44
|
-
initialI = 1;
|
|
45
|
-
}
|
|
46
|
-
for (let i = initialI; i < points.length; i++) {
|
|
47
|
-
const p2 = points[j];
|
|
48
|
-
const q2 = points[i];
|
|
49
|
-
if (doesIntersect(p1, q1, p2, q2)) {
|
|
50
|
-
return [j, i];
|
|
51
|
-
}
|
|
52
|
-
j = i;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function getClosestIntersectionWithPolyline(points, p1, q1, closed = true) {
|
|
56
|
-
let initialI;
|
|
57
|
-
let j;
|
|
58
|
-
if (closed) {
|
|
59
|
-
j = points.length - 1;
|
|
60
|
-
initialI = 0;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
j = 0;
|
|
64
|
-
initialI = 1;
|
|
65
|
-
}
|
|
66
|
-
const intersections = [];
|
|
67
|
-
for (let i = initialI; i < points.length; i++) {
|
|
68
|
-
const p2 = points[j];
|
|
69
|
-
const q2 = points[i];
|
|
70
|
-
if (doesIntersect(p1, q1, p2, q2)) {
|
|
71
|
-
intersections.push([j, i]);
|
|
72
|
-
}
|
|
73
|
-
j = i;
|
|
74
|
-
}
|
|
75
|
-
if (intersections.length === 0) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const distances = [];
|
|
79
|
-
intersections.forEach((intersection) => {
|
|
80
|
-
const intersectionPoints = [
|
|
81
|
-
points[intersection[0]],
|
|
82
|
-
points[intersection[1]],
|
|
83
|
-
];
|
|
84
|
-
const midpoint = [
|
|
85
|
-
(intersectionPoints[0][0] + intersectionPoints[1][0]) / 2,
|
|
86
|
-
(intersectionPoints[0][1] + intersectionPoints[1][1]) / 2,
|
|
87
|
-
];
|
|
88
|
-
distances.push(vec2.distance(midpoint, p1));
|
|
89
|
-
});
|
|
90
|
-
const minDistance = Math.min(...distances);
|
|
91
|
-
const indexOfMinDistance = distances.indexOf(minDistance);
|
|
92
|
-
return {
|
|
93
|
-
segment: intersections[indexOfMinDistance],
|
|
94
|
-
distance: minDistance,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function doesIntersect(p1, q1, p2, q2) {
|
|
98
|
-
let result = false;
|
|
99
|
-
const orient = [
|
|
100
|
-
orientation(p1, q1, p2),
|
|
101
|
-
orientation(p1, q1, q2),
|
|
102
|
-
orientation(p2, q2, p1),
|
|
103
|
-
orientation(p2, q2, q1),
|
|
104
|
-
];
|
|
105
|
-
if (orient[0] !== orient[1] && orient[2] !== orient[3]) {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
if (orient[0] === 0 && onSegment(p1, p2, q1)) {
|
|
109
|
-
result = true;
|
|
110
|
-
}
|
|
111
|
-
else if (orient[1] === 0 && onSegment(p1, q2, q1)) {
|
|
112
|
-
result = true;
|
|
113
|
-
}
|
|
114
|
-
else if (orient[2] === 0 && onSegment(p2, p1, q2)) {
|
|
115
|
-
result = true;
|
|
116
|
-
}
|
|
117
|
-
else if (orient[3] === 0 && onSegment(p2, q1, q2)) {
|
|
118
|
-
result = true;
|
|
119
|
-
}
|
|
120
|
-
return result;
|
|
121
|
-
}
|
|
122
|
-
function orientation(p, q, r) {
|
|
123
|
-
const orientationValue = (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1]);
|
|
124
|
-
if (orientationValue === 0) {
|
|
125
|
-
return 0;
|
|
126
|
-
}
|
|
127
|
-
return orientationValue > 0 ? 1 : 2;
|
|
128
|
-
}
|
|
129
|
-
function onSegment(p, q, r) {
|
|
130
|
-
if (q[0] <= Math.max(p[0], r[0]) &&
|
|
131
|
-
q[0] >= Math.min(p[0], r[0]) &&
|
|
132
|
-
q[1] <= Math.max(p[1], r[1]) &&
|
|
133
|
-
q[1] >= Math.min(p[1], r[1])) {
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
function getIntersection(p1, q1, p2, q2) {
|
|
139
|
-
const denominator = (q2[1] - p2[1]) * (q1[0] - p1[0]) - (q2[0] - p2[0]) * (q1[1] - p1[1]);
|
|
140
|
-
if (denominator == 0) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
let a = p1[1] - p2[1];
|
|
144
|
-
let b = p1[0] - p2[0];
|
|
145
|
-
const numerator1 = (q2[0] - p2[0]) * a - (q2[1] - p2[1]) * b;
|
|
146
|
-
const numerator2 = (q1[0] - p1[0]) * a - (q1[1] - p1[1]) * b;
|
|
147
|
-
a = numerator1 / denominator;
|
|
148
|
-
b = numerator2 / denominator;
|
|
149
|
-
const resultX = p1[0] + a * (q1[0] - p1[0]);
|
|
150
|
-
const resultY = p1[1] + a * (q1[1] - p1[1]);
|
|
151
|
-
return [resultX, resultY];
|
|
152
|
-
}
|
|
153
|
-
export { getAllIntersectionsWithPolyline, getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline, getIntersectionCoordinatesWithPolyline, };
|
|
154
|
-
//# sourceMappingURL=getIntersectionWithPolyline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getIntersectionWithPolyline.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getIntersectionWithPolyline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,SAAS,+BAA+B,CACtC,MAAsB,EACtB,EAAgB,EAChB,EAAgB,EAChB,MAAM,GAAG,IAAI;IAEb,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC,CAAC;IACN,MAAM,aAAa,GAAmB,EAAE,CAAC;IAEzC,IAAI,MAAM,EAAE;QACV,CAAC,GAAG,MAAM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C,GACvC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { getAllIntersectionsWithPolyline } from './getIntersectionWithPolyline';
|
|
2
|
-
export default function pointInPolyline(points, point, pointEnd) {
|
|
3
|
-
const intersections = getAllIntersectionsWithPolyline(points, point, [
|
|
4
|
-
point[0],
|
|
5
|
-
pointEnd[1],
|
|
6
|
-
]);
|
|
7
|
-
if (intersections.length % 2 === 0) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=pointInPolyline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pointInPolyline.js","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/pointInPolyline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAEhF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,MAAsB,EACtB,KAAmB,EACnB,QAAsB;IAEtB,MAAM,aAAa,GAAG,+BAA+B,CAAC,MAAM,EAAE,KAAK,EAAE;QACnE,KAAK,CAAC,CAAC,CAAC;QACR,QAAQ,CAAC,CAAC,CAAC;KACZ,CAAC,CAAC;IAEH,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;QAClC,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calculateAreaOfPoints.d.ts","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/calculateAreaOfPoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AASjD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,CAa5E"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Types } from '@cornerstonejs/core';
|
|
2
|
-
declare function getAllIntersectionsWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): Types.Point2[];
|
|
3
|
-
declare function getIntersectionCoordinatesWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): Types.Point2[];
|
|
4
|
-
declare function getFirstIntersectionWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): Types.Point2 | undefined;
|
|
5
|
-
declare function getClosestIntersectionWithPolyline(points: Types.Point2[], p1: Types.Point2, q1: Types.Point2, closed?: boolean): {
|
|
6
|
-
segment: Types.Point2;
|
|
7
|
-
distance: number;
|
|
8
|
-
} | undefined;
|
|
9
|
-
export { getAllIntersectionsWithPolyline, getFirstIntersectionWithPolyline, getClosestIntersectionWithPolyline, getIntersectionCoordinatesWithPolyline, };
|
|
10
|
-
//# sourceMappingURL=getIntersectionWithPolyline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getIntersectionWithPolyline.d.ts","sourceRoot":"","sources":["../../../../../src/utilities/math/polyline/getIntersectionWithPolyline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAOjD,iBAAS,+BAA+B,CACtC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EACtB,EAAE,EAAE,KAAK,CAAC,MAAM,EAChB,EAAE,EAAE,KAAK,CAAC,MAAM,EAChB,MAAM,UAAO,GACZ,KAAK,CAAC,MAAM,EAAE,CAyBhB;AAMD,iBAAS,sCAAsC,CAC7C,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EACtB,EAAE,EAAE,KAAK,CAAC,MAAM,EAChB,EAAE,EAAE,KAAK,CAAC,MAAM,EAChB,MAAM,UAAO,GACZ,KAAK,CAAC,MAAM,EAAE,CAgBhB;AAMD,iBAAS,gCAAgC,CACvC,MAAM,EAAE,KAAK,CAAC,MA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