ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract inner XY coordinates

Solved!
Go to solution

Hi,

I need to calculate the area "inside" the collection of given XY coordinates, basically the inner part of the XY graph.

In know how to calculate area for XY coordinates but I can't figure out how to extract the "inner" ones from this collection.

I hope I was clear... ...

All inputs are welcome!

Regards

Alain

0 Kudos
Message 1 of 10
(5,591 Views)
Solution
Accepted by Alain_S

I have attempted this with your data.

Capture.PNG

Adjusting the Sensitivity gives fewer or more points, for your data a sensitivity of 14 gave the optimum result. It would scale with how many "loops" your data has, I suggest using double the number of loops.

 

File attached.

I noticed you used LV2012, so have not utilised the sort 2D array function from LV2017 (or the OpenG one, for ease of sharing)

 

There may be easier ways which I have missed, and this may be able to be optimised (I've assumed the dataset is small), but this one gives a fairly good set of "inner" XY coordinates. You mentioned you could do the rest.

 

Let me know if it works for you.

Ian
LabVIEW since 2012
Message 2 of 10
(5,553 Views)

Ed. This is basically the same first step as IanSh proposed above.

 

Not a solution, but a tip: try converting carthesian coordinates to cylindrical. Then calculate the area under the points clouds, which might be easier:

CarthesianToCylindrical.png

 

Message 3 of 10
(5,545 Views)

Hi,

Thanks for quick and accurate answer.

I tried this method on several datasets, all works fine!

 

Best regards!

0 Kudos
Message 4 of 10
(5,529 Views)

I'm just interested, why would this be easier:

"try converting carthesian coordinates to cylindrical. Then calculate the area under the points clouds, which might be easier:"

 

 

0 Kudos
Message 5 of 10
(5,506 Views)

@alexderjuengere wrote:

I'm just interested, why would this be easier:

"try converting carthesian coordinates to cylindrical. Then calculate the area under the points clouds, which might be easier:"

 

 


As in IanSh solution - you need to find minimum "edge" of the points cloud and then integrate (sum) area under this edge. I can't exactly find the direct way to calculate this area in original (carthesian) representation, but I can think about a few ways to do it in polar* coordinates.

 

 

*I've used conversion from carthesian to polar with Z values = 0. This is the same as converting Re/Im To Polar - I just didn't yet read enough altenbachs posts to immediately think about 2D planes with complex numbers ;D

0 Kudos
Message 6 of 10
(5,470 Views)

PiDi wrote:


... ... ..  I can't exactly find the direct way to calculate this area in original (carthesian) representation, but I can think about a few ways to do it in polar* coordinates


[url=https://en.wikipedia.org/wiki/Shoelace_formula] CLICK [/url] 

Message 7 of 10
(5,460 Views)

Neat, I hadn't thought about looking up that part as you had said you have a solution. Of course LabVIEW has a function already for this.

You can use Polygon Area.vi to calculate the area. I just looked inside, it actually uses this same shoelace formula Smiley Happy

In fact, you may find other useful functions in Mathematics>Geometry>Computational Geometry. Never been inside that palette before.

 

It will be quite important (I expect) to make sure the sensitivity is set correctly, as a single outlying point may throw your answer off a bit.

Ian
LabVIEW since 2012
0 Kudos
Message 8 of 10
(5,453 Views)

@Alain_S wrote:

@PiDi wrote:


... ... ..  I can't exactly find the direct way to calculate this area in original (carthesian) representation, but I can think about a few ways to do it in polar* coordinates


[url=https://en.wikipedia.org/wiki/Shoelace_formula] CLICK [/url] 


Ok, wrong wording, I wanted to say that finding the internal points is harder, no the area calculation itself 😉 Thanks for the link though!

0 Kudos
Message 9 of 10
(5,447 Views)

@PiDi wrote:

 

*I've used conversion from carthesian to polar with Z values = 0. This is the same as converting Re/Im To Polar - I just didn't yet read enough altenbachs posts to immediately think about 2D planes with complex numbers ;D


Indeed, I like that your implementation with "3d coordinate conversion.vi" can be easily extend to a 3d space

compariosn.JPG

 

 

Moreover, I personally like about IanSh .vi, that it is very easy to find the edge points of the point cloud

boundings.PNG

 

Kudos to all of you

0 Kudos
Message 10 of 10
(5,439 Views)