LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intersections between line and polygon

Hello,

 

I am currently searching for a VI to fill the polygon shape with parallel line patterns. However, it seems there is no ready VI to use.

So I start to work from scratch. One core VI then would be find the intersections between a line and a polygon.

Indeed, I found Convex Polygon Intersection VI  (Shown in the Figure below) and Lines Intersection VI  which are not 100% fit my objective. Can anyone give some hints?

If there is no existing VI, I plan to bulid a VI that caculate line interesection with each line of a polygon, but I guess it would be computional expensive. 

 

Thank you for your comment either about the polygon fill with lines or intersections between a line and a polygon.

 

Sparkle

 

Capture.PNG

0 Kudos
Message 1 of 9
(4,341 Views)

It is always helpful to attach a VI, even if you are just getting started and have very little code, as it will tell us some things about what you are doing.

 

So I'm going to assume (= "guess") that you are talking about 2D Pictures from the Graphics and Sound Palette.  If I were doing this, I would do it a little differently than you describe.

 

I'd start by drawing an image full of parallel lines (using the Draw Line function) -- this will become my "fill".  I'd use the Polygon information to create a Mask (keep everything inside the Polygon, clear everything outside the Polygon) and apply it to my "fill".  Add the polygon, itself, and you have a "filled polygon".  Repeat as needed.

 

Bob Schor

0 Kudos
Message 2 of 9
(4,309 Views)

If you have MGI installed, the Coordinates palette has a 2D intersection of 2 lines VI.  You only have to supply the endpoints of the lines.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 9
(4,304 Views)

Do you need their coordinates, or do you finally need to see a filled polygon as an image?

Look at mask features: draw lines over all image (or rectangle that covers all polygon), convert polygon into mask (ROI to mask, etc), apply mask, profit..

0 Kudos
Message 4 of 9
(4,295 Views)

Hello Alexander,

 

I have the coordinates of those polygon and I am thinking to use both ways : image processing tool or pure geometry algorithms.

 

After one day's work, I can realize some of my expectations now (see figure below). But it is still not as good as I want.

If some happens to know some basic algorithms which are easy to implement in LabVIEW or ready to use C library, I appreciate for the comment.

 

Best Regards,

sparkle 

 

 

 

Capture.PNG

 

 

0 Kudos
Message 5 of 9
(4,285 Views)

Dear Bob,

 

That is what I have done today. Thanks for the comment.

 

Best Regards,

Sparkle

 

0 Kudos
Message 6 of 9
(4,283 Views)

Hello Aputman,

 

Thanks for the comment. It is my first time to know that there are external function libraries existing. I will have a look tomrrow.

 

Best Reagrds,

Sparkle

0 Kudos
Message 7 of 9
(4,279 Views)

Hello, can you send me this programm

0 Kudos
Message 8 of 9
(4,002 Views)

I have just released a couple of VIs for polygon clipping/growing/shrinking on VI package manager. The polygons are not restricted to convex polygons but can be arbitrary.  

The VIs can be found on VIP by searching for 4SmartMachines.

0 Kudos
Message 9 of 9
(2,902 Views)