06-21-2006 06:16 AM
06-21-2006 06:30 AM
Hi
Just by looking briefly at your vi, I must tell you, that it obviously does not indicate intersections properly. Just by comparing some ranges you probably will never get the correct state.
You have to do some maths. The line is defined: y = mx+b. You can calculate m and b because you have two given points. The circle is also defined: y = yc +/- sqrt(r^2 - (x - xc)^2). So basically you have to solve an equation to get the intersection points. Maybe there is already something available in LV.
06-21-2006 07:12 PM
Thank you for your kind reply.
Actually the first VI i made is from math. I took the equation of a circle and line as what you indicated. Please find the attached VI. Kindly run this VI and input the following coordinates points to see two case;
1st. case, P1 (4,6) P2 (6,-3)
2nd case, P1 (2,8) P2 (3,5)
On the first case, if you will increase the slide bar (radius of a circle) and touches the line, we can see that it actually intersects the line through the LED. But on the second case, if you slowly increase the radius, because of the characteristic of a line which extends to infinity, even if its not touching the line, it will show it intersects through the LED.
This is my problem. I want to show that even if the radius is equal or greater than the perpendicular distance to the line, but actually not touching the line, it should not show it intersects. It will only show it intersects if it touches the line.
Kindly help me please. I would appreciate any advise from your experience. Thank you very much.
06-21-2006 07:29 PM
Maybe this thread.
http://forums.ni.com/ni/board/message?board.id=170&message.id=136882&requireLogin=False
Or use the limit testing vi's. Make the circle the limit line and the line your data. See this example.
C:\Program Files\National Instruments\LabVIEW 7.0\examples\measure\maxmpl.llb\Limit Testing Measurement.vi
C:\Program Files\National Instruments\LabVIEW 7.0\examples\measure\maxmpl.llb\Limit Testing for Unevenly Sampled Data Measurement.vi
If you are using array data, I have some limit vi's for array data rather than waveform datatypes.
06-21-2006 08:49 PM
06-22-2006 12:50 AM
06-22-2006 07:34 AM
You have a couple of options to make array data into a waveform datatype. There is a resample waveform vi that can take in an array of XY pairs or multiple arrays of pairs and turn this into a waveform.
C:\Program Files\National Instruments\LabVIEW 7.0\vi.lib\measure\maresamp.llb\Resample Array of Pairs (single shot).vi
If you have evenly spaced array data, you can use the Build Waveform function by specifying the t0, dt, Y array as inputs.
Attached is a 7.0 format file that has the array based limit testing vi's inside the .llb file.
12-06-2012 04:30 PM
Here it is. I had to make this solution for one of my projects. Feel free to use it. the following link helped me much:
http://mathworld.wolfram.com/Circle-LineIntersection.html
The example is in LV 2010 including NI Vision, but the calculations are pure in LV.