protected void calculateScreenCoordinates() { // Calculate coordinates minZ = Double.MAX_VALUE; maxZ = -minZ; synchronized (shapes) { for (Shape shape : shapes) { if (shape == null || shape.realCoordinates == null) continue; shape.screenCoordinates = visualizer3D.screenPosition(shape.realCoordinates); if (shape.screenCoordinates != null) { minZ = Math.min(minZ, shape.screenCoordinates.z); maxZ = Math.max(maxZ, shape.screenCoordinates.z); } } } minZ -= visualizer3D.scalePixelsPerAngstrom * 2; maxZ += visualizer3D.scalePixelsPerAngstrom * 4; }