# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Re: Roundness calculations

elset191 wrote:
You can just do a rotation of all the points ...

That sounds a little easier said than done.

Is there an easy way to do that?

Cory K
Message 11 of 24
(1,584 Views)

## Re: Roundness calculations

Mathematics -> Geometry -> 2D Cartesian Coordinate Rotation.

Of course when I did it way back when I didn't know about this VI so wrote it myself.

--
Tim Elsey
Certified LabVIEW Architect
Message 12 of 24
(1,580 Views)

## Re: Roundness calculations

Hi Cory,

I think that with

Center x-value = [(max x-value)+(min x-value)] / 2

Center y-value = [(max y-value) + (min y-value)] / 2

you wil calculate the center point of the minimum circumscribed BOX, not circle!

If by any luck, your box is a square then it's ok but I'm pretty sure that it will never be the case 😞

Message Edited by Alain S on 06-02-2009 10:47 AM
Message 13 of 24
(1,568 Views)

## Re: Roundness calculations

You should be able to pose this as a sort of constrained optimization problem.  The LS circle is just the unconstrained solution (minimize the LS distance between the datapoints and the circle).  For the maximum inscribed circle the constraint is that no datapoint should lie inside the circle (distance from any datapoint to the circle center must be greater than the circle radius).  For the minimum circumscribed circle all datapoints should lie inside the circle (distance from any datapoint to the circle center must be less than the circle radius).  The constrained nonlinear optimization.vi should be able to solve this problem.

Message 14 of 24
(1,545 Views)

## Re: Roundness calculations

I found a way to calculate MCC

Start the VI and.......................have a break 🙂

So now I need a) a super computer or b) valuable data reduction

I'll go for the last one and also a way to find MIC & MZC, keep you posted guys ... ... ...

I took a rough look at the constrained nonlinear optimization.vi but I don't know yet how to translate the constraints you mentioned into LV code 😞

Can you help a little bit more DSPGuy?

Regards

Alain

Message 15 of 24
(1,529 Views)
Solution
Accepted by Alain_S

## Re: Roundness calculations

Okay,  I implemented a first pass at the MCC and MIC using the constrained optimization VI.  I modified your original VI, and now display the MCC and MIC on the same graph as the same graph as the data and the LS circle.  I commented the model functions so the mapping is clearer (I hope).  Performance seems pretty good, with both circles being found within 700 mS or so on my desktop machine.
Message 16 of 24
(1,502 Views)

## Re: Roundness calculations

I'll have to install V8.6 first, I have the CD's somewhere but......... can't find them right now

it looks good on a graph but when zooming in it isn't anymore 😞

I have a dataset with known values for centerpoint and radius and the error I get is too large 😞

As soon as I have V8.6 installed I will test your code with the same dataset and let you know the outcome!

Thanks for your help so far

Regards

Alain

Message 17 of 24
(1,486 Views)

## Re: Roundness calculations

Reposting code saved for LabVIEW 8.21.
Message 18 of 24
(1,467 Views)

## Re: Roundness calculations

Thanks for the "earlier" version but I already have 8.6 installed and translated to V8.5. I

also did some caculations.

A first sight it's ok but with some objects I don't get an answer for MIC or MCC or even both.

It seems that how the more unround a shape is or the more spread there is in the data, the more critical it is to set correct start parameters.

I'll make a vi with some datasets to explain the above.

To be continued... ...

Message 19 of 24
(1,461 Views)

## Re: Roundness calculations

As promised a vi with some datasets that genereates errors instead of answers

I'll have a closer look at that vi in the week-end ...

Message 20 of 24
(1,441 Views)