File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import getSpacingInNormalDirection from './getSpacingInNormalDirection';
1717import getTargetVolumeAndSpacingInNormalDir from './getTargetVolumeAndSpacingInNormalDir' ;
1818import getVolumeActorCorners from './getVolumeActorCorners' ;
1919import indexWithinDimensions from './indexWithinDimensions' ;
20+ import indexAlmostWithinDimensions from './indexAlmostWithinDimensions' ;
2021import getVolumeViewportsContainingSameVolumes from './getVolumeViewportsContainingSameVolumes' ;
2122import getViewportsWithVolumeId from './getViewportsWithVolumeId' ;
2223import transformWorldToIndex , {
@@ -140,6 +141,7 @@ export {
140141 getTargetVolumeAndSpacingInNormalDir ,
141142 getVolumeActorCorners ,
142143 indexWithinDimensions ,
144+ indexAlmostWithinDimensions ,
143145 getVolumeViewportsContainingSameVolumes ,
144146 getViewportsWithVolumeId ,
145147 transformWorldToIndex ,
Original file line number Diff line number Diff line change 1+ import { EPSILON } from '../constants' ;
2+ import type { Point3 } from '../types' ;
3+
4+ /**
5+ * Returns true if the specified index is within the given dimensions.
6+ *
7+ * @param index - The index to check.
8+ * @param dimensions - The dimensions to check against.
9+ *
10+ * @returns True if the index is in-bounds.
11+ */
12+
13+ export default function indexAlmostWithinDimensions (
14+ index : Point3 ,
15+ dimensions : Point3
16+ ) : boolean {
17+ if (
18+ index [ 0 ] < - EPSILON ||
19+ index [ 0 ] >= dimensions [ 0 ] + EPSILON ||
20+ index [ 1 ] < - EPSILON ||
21+ index [ 1 ] >= dimensions [ 1 ] + EPSILON ||
22+ index [ 2 ] < - EPSILON ||
23+ index [ 2 ] >= dimensions [ 2 ] + EPSILON
24+ ) {
25+ return false ;
26+ }
27+
28+ return true ;
29+ }
Original file line number Diff line number Diff line change @@ -424,7 +424,7 @@ abstract class BaseTool {
424424 public static isInsideVolume ( dimensions , indexPoints ) {
425425 const { length : count } = indexPoints ;
426426 for ( let i = 0 ; i < count ; i ++ ) {
427- if ( ! csUtils . indexWithinDimensions ( indexPoints [ i ] , dimensions ) ) {
427+ if ( ! csUtils . indexAlmostWithinDimensions ( indexPoints [ i ] , dimensions ) ) {
428428 return false ;
429429 }
430430 }
You can’t perform that action at this time.
0 commit comments