TracedRay trace_ray(Surface surface, TraceIntensityMode m, RayTraceResults result, TracedRay incident, Vector3Pair local, Vector3Pair pt) { incident.set_len((pt.origin().minus(local.origin())).len()); incident.set_intercept(surface, pt.origin()); if (m == TraceIntensityMode.Simpletrace) { incident.set_intercept_intensity(1.0); return(trace_ray_simple(surface, result, incident, local, pt)); } else { // apply absorbtion from current material double i_intensity = incident.get_intensity() * incident.get_material().get_internal_transmittance( incident.get_wavelen(), incident.get_len()); incident.set_intercept_intensity(i_intensity); // FIXME // if (i_intensity < _discard_intensity) // return; if (m == TraceIntensityMode.Intensitytrace) { return(trace_ray_intensity(surface, result, incident, local, pt)); } else if (m == TraceIntensityMode.Polarizedtrace) { return(trace_ray_polarized(surface, result, incident, local, pt)); } else { throw new InvalidOperationException(); } } }