LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

segment intersections

Hi all,

 

A bunch of lines (segments) which are defined by a Start XY and End XY co-ordinates. 

 

These segments overlap to form a GRID.  I must find and divide these segments at their intersections.

 

The image below shows 4 segments (black lines) which intersect (intersections highlighted by red circle).  The result for this example should be 12 segments which are connected are their endpoints only.

 

4 segments which cross.jpg

Message Edited by battler. on 05-21-2010 07:48 PM
Message Edited by battler. on 05-21-2010 07:51 PM
0 Kudos
Message 1 of 7
(4,062 Views)

I have implemented a method of finding Segment-Segment intersections based on the code given in "Computational Geometry in C." by Joseph O'Rourke.  However, I want to be able to do this reliably and this code does not deal well with the issues with floating point numbers.

 

Are there in-built tools in LabVIEW which can do (or help me to do) what I want with these segments (i.e. to find segment intersections, or to build a grid from segments)?  Currently I am looking at (but have never used) the MathScript functions.

 

Does anybody know how to solve this problem?

0 Kudos
Message 2 of 7
(4,054 Views)
If you know the start and end point you can calculate the slope (rise/run) then translate the line so it crosses the start point. Once you do these two things you should have a polynomial for your line. Then you simply solve one equation for the other to find the intersection. Once you have the intersections, you can build your line segments.
0 Kudos
Message 3 of 7
(4,012 Views)

Hueter wrote:
If you know the start and end point you can calculate the slope (rise/run) then translate the line so it crosses the start point. Once you do these two things you should have a polynomial for your line. Then you simply solve one equation for the other to find the intersection. Once you have the intersections, you can build your line segments.

 

That's a valid although inefficient way of doing it.

 

Are there any in-built tools available in LV to find segment(vector) intersections?

0 Kudos
Message 4 of 7
(4,001 Views)

I'd start with the approach Hueter suggested. But the equations will form a set of linear equations which you can solve using linear algebra functions. I'm not into LA, but if I remember correctly, that was one of the indroduction use cases for that topic.

 

Felix 

0 Kudos
Message 5 of 7
(3,982 Views)

I would also be interested in an answer to this one and any ideas.  We are looking at glass fibre length distributions and crossing fibres pose real problems.

 

I have attached a thresholded image showing a typical distribution.

0 Kudos
Message 6 of 7
(3,684 Views)

@bparveen wrote:

We are looking at glass fibre length distributions and crossing fibres pose real problems.


This is a completely different problem and I would recommend that you start a new thread.

 

This thread is about finding line segments seperated by crossover points, while you are looking for the lenghts of the entire fibers, ignoring any crossovers.

0 Kudos
Message 7 of 7
(3,658 Views)