LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

area

I would like to know if there is some function that determines if a point (coordinated x, y) it is inside a limited area.
Thanks
0 Kudos
Message 1 of 7
(3,298 Views)

Depending on how the area is defined, it may be fairly easy to write code to calculate this.

Is this IMAQ? Picture Control? VI coords? Something else?

How are you defining the area? Rectangle? Circle? Array of coordinates?


___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(3,288 Views)

The area that I obtain is irregular and this defined one for points (for example for 20).

it is not a regular area as a square or an I circulate. 


With this area I have to create a mesh of points in their interior, and I want that the one limits it is the area.

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

The IMAQ tools can probably do this, but since I don't use it, I'll give you a direction.

I just came up with a much simpler solution, but I will include my original idea as well just in case. The simple solution is this - Create a picture control even if you're not using one. You don't even need to see it. Use the coordinates array with Draw Multiple Lines to draw a filled shape, then use Picture to Pixmap, unflatten the pixmap and check the value of the pixel. If it's black, it's in the shape. If it's white it isn't. Simple as that.

My original thought:

This is probably not the most efficient way to do this, but I think it should work. I will assume that you use the picture control, but this can probably be adapted for other coordinates. One additional assumption is that the points are in order in the array and that there are no intersecting lines.

The method is basically this - First, use a for loop with an unbundle to seperate the X and Y arrays and check if either the X or Y of your point is outside this range. If either of them is outside the range, your point is not in the shape.

Then, you could start using geometry to calculate to start calculating the distance from that point to all the lines of the shape, find the closest one and go from there.


___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(3,256 Views)
Here's a VI that will tell you if a point is within an area. The point is defined as x,y and the area is defined as a array of x,y points. The area can be any shape you wish. The inclusion border is a linear interpolation between the points you provide. I've had it floating around in my toolbox for a while now -- Comes in pretty handy sometimes. No idea how it works, I didn't write and and have never tried to figure it out, all I know is it works well. Credit for the routine's brainpower is included in the VI.
 
Randy
Message 5 of 7
(3,235 Views)
Thanks a lot!!!
 
I don't understand how it works too but I proved it and works properly.
 
Thanks again!!!!!!!!!!!!!
 
Greta
 
Smiley Happy
0 Kudos
Message 6 of 7
(3,212 Views)

You're welcome... Glad it worked for you.

 

Randy

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