UNPKG

@cornerstonejs/core

Version:
16 lines (15 loc) 504 B
import { vec3 } from 'gl-matrix'; export function getSafeCanvasDimension(value) { return Math.max(value || 0, 1); } export function normalizePoint3(point, fallback) { const normalized = vec3.normalize(vec3.create(), point); if (fallback && (!Number.isFinite(normalized[0]) || !Number.isFinite(normalized[1]) || !Number.isFinite(normalized[2]) || vec3.length(normalized) === 0)) { return vec3.clone(fallback); } return normalized; }