LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i find the intersection in the given figure

intersection.JPG

Please help me, How can I find the intersection points (x,y) in the given figure.

please give some suggestions.

0 Kudos
Message 1 of 8
(2,657 Views)

Hi Rajesh,

 

I guess you want to find the point [1, 2] as "intersection".

 

From what you have shown:

  1. Create an array of points (aka cluster of X and Y value) from your two input arrays.
  2. Test for any duplicate points in your point array (use Search1DArray…)

(When you want to calculate points where lines cross: this is simple mathematics you should have learned in school. Apply math…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(2,621 Views)

Your intersection is actually at one of the actual points and thus is a set of coordinates that occurs twice. Given this information, the solution us trivial. (In addition, the start and end points overlap to close the curve, so keep that in mind)

 

Programming is typically more interesting and should work with any finite set of arbitrary line segments. As a first step, generate two random lines defined by two points each and see if they cross (or touch), and if so where. Solve the general problem!

 

0 Kudos
Message 3 of 8
(2,609 Views)

Thanks, GerdW 

But I have some doubts

Here it is clearly visible that where the line intersects so you suggest search for the intersect element. But if a graph is complicated with 10000 data-set then this might not work as it may be difficult to locate the point exactly

Suppose I need to calculate this intersection with online data then what I can do.

Thank you again.

0 Kudos
Message 4 of 8
(2,579 Views)

Hi Rajesh,

 


@Rajesh10 wrote:

Suppose I need to calculate this intersection with online data then what I can do.

Did you read Christians and my answer?

Apply basic math!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(2,572 Views)

0 Kudos
Message 6 of 8
(2,569 Views)

@Rajesh10 wrote:


No it isn't.  It is a bunch of line segments between a series of points that are defined by an X array and Y array.

 

What you have is not really a LabVIEW problem.  At least not yet.  It is a Math/Geometry problem.

 

How would you find the answer if all you had was pencil and paper?

0 Kudos
Message 7 of 8
(2,562 Views)

Once you solve the problem I gave you earlier, make it into a subVI, then go inspect every line segment in order and see if it touches any line segment you already looked at. You also need to deal with special cases (e.g. two lines overlap, two segments are identical, one point touched another line but the lines do not cross, one long line crosses several other segments, etc.).

0 Kudos
Message 8 of 8
(2,521 Views)