/** * Intersects the given ray with all the geometry in the scene. * * @param r ray to check * @param omit optional traceable that the ray should not collide against * @return intersection data */ public SceneIntersectionResult intersect(Ray r, Traceable omit) { float d = Float.MAX_VALUE; IntersectionResult result = null, isr; Traceable hit = null; for (Traceable t : m_traceables) { if (t == null || t == omit) continue; isr = t.intersect(r); if (isr.intersects() && isr.getDistance() < d) { hit = t; result = isr; d = isr.getDistance(); } } if (result == null) return new SceneIntersectionResult(); return new SceneIntersectionResult(hit, result); }