Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import { Types } from '@cornerstonejs/core'; import distanceToPointSquared from './distanceToPointSquared'; /** * Calculates the squared distance of a point to an AABB using * 2D Box SDF (Signed Distance Field) * * The SDF of a Box * https://www.youtube.com/watch?v=62-pRVZuS5c * * @param aabb - Axis-aligned bound box (minX, minY, maxX and maxY) * @param point - 2D point * @returns The squared distance between the 2D point and the AABB */ export default function distanceToPoint( aabb: Types.AABB2, point: Types.Point2 ): number { return Math.sqrt(distanceToPointSquared(aabb, point)); } |