From e91a272b76e6779953bdc21a7f587b143b516de8 Mon Sep 17 00:00:00 2001 From: rondlh <77279634+rondlh@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:29:25 +0800 Subject: [PATCH] Limit Z-range to within reasonable bounds Limit Z-range to within reasonable bounds Range: -1200 to +1200mm Note: The handle position is limited, for Z-arrow it's 5mm above the object --- .../bowlerstudio/threed/BowlerStudio3dEngine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/threed/BowlerStudio3dEngine.java b/src/main/java/com/neuronrobotics/bowlerstudio/threed/BowlerStudio3dEngine.java index 044b1d411..8e7a6b006 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/threed/BowlerStudio3dEngine.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/threed/BowlerStudio3dEngine.java @@ -340,7 +340,8 @@ public double sceneToWorldFixedXY_WP(Point2D scenePixel, double fixedX, double f else t = ((fixedX - ox) * dx + (fixedY - oy) * dy) / denom; - return localOrigin.getZ() + t * localDir.z; + // Limit range to within -1200 and +1200mm + return Math.max(-1200, Math.min(localOrigin.getZ() + t * localDir.z, 1200)); } catch (NonInvertibleTransformException e) { return 0;