I am trying to implement a simple beam tracing simulation. Basically it models the path of a beam within a pipe:
In the picture, the beam starts emitting from p1, hitting the boundary at p2 and reflects to p3. I was thinking of the algorithm of such a system. Assuming that all equations of the 2 blue curves are known:
1) Get the parametrized representation of original line from p1, say p1(t).
2) Equate p1(t) with both curves.
3) Find the first intersection p2, determined by the lowest value of t.
4) Get the normal at the intersection and get the equation of the reflected beam, p2(t).
5) Equate p2(t) with both curves, eventually solving for p3.
6) Repeat for as many iterations as needed.
My question is that, is there more sophisticated way of doing this? Or is there a library out there that implements this kind of functionality directly? Currently I am using C#, and looking into WPF and also OpenGL, but I am afraid that OpenGL may be too low level (?) and requires much code to achieve this.