11-16-2012 10:46 AM - edited 11-16-2012 10:50 AM
Hello,
i am working currently on one project - i have an optical system (some prisms, some lenses etc) and i want to make a VI to calculate propagation of a light ray - something like ray tracing.
I know that labview is not the perfect platform to deal with this issue, however i still would like to try.
My problem is as following: i want to calculate the propagation of a ray through a lens. I have the ray with some coordinate (y=const) and a plano convex lens - the front of a lens is a piece of a sphere. To calculate the propagation (using snell law) I have to find an angle between the ray and the line which is tangent to this lens-sphere in the point where my light beam hits the lens.
My procedure (on the piece of paper):
1.i know the coordinates of a center of a sphere (let's take (0,0)) and its radius r (x^2+y^2=r^2). I know the value of y=y_0 for which the ray enters the lens.
then i can calculate the x_0: x_0^2+y_0^2=r^2. Now i know the point where light enters the lens (x_0,y_0)
2.then just the usual procedure of finding equation for a line tangent to sphere (y=a*x+b):
i put y_0 and x_0 to this equation:
y_0=a*x_0+b
and i can remove one unknown value (for example b): y=a*(x-y_0)+x_0
3.then i put such equation into the equation for sphere (x^2+y^2=r^2) and this is the quadratic equation which has only one unknown value x and one free parameter: a.
4.beacause i want to have tangent line, so it should have only one common point with sphere - so the quadratic equation should have determinant equal to zero (only one solution for x). This gives me an equation for a. I should find the value of a which satisfy this equation and then i know this tangent line and have the solution! uf....
Unfortunately i still didn't find a solution to implement this in labview (and i'm motivated beacuse most of the work for this project is already done). I was trying with the formula parsing and so on, but i didn't succeeded.
I will be really grateful for any hints or help!
Solved! Go to Solution.
11-16-2012 11:27 AM
I have also one idea:
i wanted to use polynomial VIs, it will work fine, however i have these unknown parameter a which i want to find in the end. And in polynomial VIs as an input i can use only numbers (double) as coefficients. Is it possible to use somehow these VIs and place some free parameter as an input?
11-16-2012 08:52 PM
helmik,
LabVIEW does not do symbolic math. Once you have the equations solved on paper or reduced to a set which can be solved numerically, tehn you can program it in LV.
When I look at your math in the first post, I see that in (3) you describe an equation in x and a. However, this is not a quadratic equation but a fourth order polynomial with terms like a^2*x^2 and 2*a^2*x*y_0. So this is not so easily solved.
Is not the tangent to the sphere at right angles to the radius at that point? The angle of the radius can be calculated from x_0 and y_0 and the center of the sphere. Then add 90 degrees. One arctangent and no complicated equations.
Lynn
11-17-2012 10:20 AM
Hey Lynn,
thank You very much for help and your idea.
Sometimes it's too hard to look for some much easier solutions, when you already have one 😉
11-17-2012 06:32 PM
helmik,
Sometimes it is hard to see the forest for the trees.
Glad to be able to offer a dfifferent perspective.
Lynn
11-18-2012 10:32 AM
Hi Guys,
I neeed help to solve this, appreciate anyone's help
11-18-2012 12:29 PM
Liz.b,
Your attachment does not actually state what is to be solved! What are you trying to do? What does this have to do with LabVIEW? Is this a school assignment?
Lynn
11-18-2012 02:29 PM
Thanks for the reply, I'm sorry if I posted on wrong forum, actually need to draw the attached image using ray tracing.
Liz.
11-18-2012 02:37 PM
Liz,
This is a Forum for helping people learn to program using LabVIEW, which emphasizes measurements and control. While you could certainly program ray tracing in LV, I doubt that is what you are wanting to do. It would be a non-trivial task for an experienced LV programmer and probably almost overwhelming for a beginner.
If I have misinterpretted your intent, please clarify what you want.
Lynn