Tracing Rays in c#