Ray tracing through a prism is nothing conceptually new -- it is just an application of the rules of reflection and refraction. There can be surprises, though. We will look at the ray transmitted through a triangular prism, ignoring internal reflections. The surprise is that "most" transmitted rays are deviated through roughly the same angle, a bit less than 40 degrees in our example, irrespective of the angle of incidence of the ray on the prism! This is not a violation of Snell's Law, as it might at first seem, but rather a subtle consequence of it.
The angle of minimum deviation is responsible for some meteorological phemomena, like halos and sundogs , produced by deviation of sunlight in the hexagonal prisms of ice crystals in the air. Reflection from raindrops -- another exercise in ray-tracing -- shows a minimum deviation angle: that's the rainbow! In all cases you can imagine as a first approximation that the light is deviated through just one special angle, the angle of minimum deviation.
The minimum deviation D in a prism occurs when the entering angle and the exiting angle are the same, a particularly symmetrical configuration. Applying Snell's Law at the interfaces you can derive the following relationship:
where n is the relative index of refraction of the prism, and a is the angle between the two relevant prism faces (60 degrees in our example). Using this relationship, you could figure out what index of refraction was assumed for this simulation. You could also use this method to measure the index of refraction of real materials.