topic Re: Roundness calculations in LabVIEW
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918336#M413353
The ellipse doesn't necessarily have it's axes aligned with the X and Y axes.Tue, 02 Jun 2009 15:09:17 GMTelset1912009-06-02T15:09:17ZRoundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/917930#M413208
<P>Hi there, </P><P> </P><P>Roundness can be defined by means of different methods. So far I found MRS or MZC, MIC, MCC and LSC.<BR />Complete description in the VI as comment <span class="lia-unicode-emoji" title=":slightly_smiling_face:">🙂</span></P><P> </P><P>So far I managed to calculate LSC because LV provide a VI for it <span class="lia-unicode-emoji" title=":slightly_smiling_face:">🙂</span></P><P> </P><P>Can someone please help me with the other ones?</P><P>I can't finad a way to determine the radius and offset of the maximum inscribed circle and minimum circumscribed circle.</P><P>Does anyone has the formulas to calculate those circles?</P><P> </P><P>Thanks a lot</P><P>Alain</P>Tue, 02 Jun 2009 06:36:38 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/917930#M413208Alain_S2009-06-02T06:36:38ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918253#M413314
<P>For MIC and MCC I took the center as the (x0,y0,z0) that was returned by LSC. Then found the closest and farthest points from that point and used those as the radii for MIC and MCC.</P><P> </P><P>It should be noted that I don't know if this is an official way to do the calculation. It made sense in my head though. </P><DIV class="message-edit-history"><SPAN class="edit-author">Message Edited by elset191 on </SPAN><SPAN class="local-date"> 06-02-2009</SPAN><SPAN class="local-time"> 09:26 AM</SPAN></DIV>Tue, 02 Jun 2009 14:26:29 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918253#M413314elset1912009-06-02T14:26:29ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918279#M413323
<P>Thanks for the effort Tim but taking the center point from the LSC circle as zero point for MIC & MCC circles is not right <span class="lia-unicode-emoji" title=":disappointed_face:">😞</span></P><P>And that's my problem, how to find the middle point of those circles. </P><P> </P><P>I think there is a formula to determine them but I can't find them on the web <span class="lia-unicode-emoji" title=":disappointed_face:">😞</span></P><P>I found formulas for area and gravity point but not for MIC & MCC <span class="lia-unicode-emoji" title=":disappointed_face:">😞</span></P><P> </P><P>Anyway, thanks for your work so far.</P><P> </P><P>I can't open your VI, I have V8.5 instead of V8.6</P><P> </P><P>Regards</P><P>Alain</P>Tue, 02 Jun 2009 14:41:15 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918279#M413323Alain_S2009-06-02T14:41:15ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918292#M413331
Well, if you find a way to find the proper center, you just have to switch two wires. I've attached my VI in 8.5 so you can see it.Tue, 02 Jun 2009 14:47:20 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918292#M413331elset1912009-06-02T14:47:20ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918309#M413340
<P>Half of the job is done <span class="lia-unicode-emoji" title=":slightly_smiling_face:">🙂</span></P><P>I'll keep looking for the other half <img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.ni.com/i/smilies/16x16_smiley-wink.gif" alt="Smiley Wink" title="Smiley Wink" /></P><P> </P><P>Thanks for the V8.5 vi.</P><P> </P><P>Regards</P><P>Alain</P>Tue, 02 Jun 2009 14:54:51 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918309#M413340Alain_S2009-06-02T14:54:51ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918318#M413345
<P>Since (0,0) isnt the center, how about this.</P><P> </P><P>Center x-value = [(max x-value)+(min x-value)] / 2</P><P>Center y-value = [(max y-value) + (min y-value)] / 2</P><P> </P><P>Then your center will be (center x, center y)</P>Tue, 02 Jun 2009 15:00:49 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918318#M413345Cory_K2009-06-02T15:00:49ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918320#M413347
<P>And to find out how round the circles are:<BR /><BR />(largest diameter in y-direction) - (largest diameter in x-direction)</P><P> </P><P>As this difference approaches 0, the circle is more and more circular (less eliptical)</P>Tue, 02 Jun 2009 15:03:24 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918320#M413347Cory_K2009-06-02T15:03:24ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918336#M413353
The ellipse doesn't necessarily have it's axes aligned with the X and Y axes.Tue, 02 Jun 2009 15:09:17 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918336#M413353elset1912009-06-02T15:09:17ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918345#M413356
<P>That shouldnt be a problem.</P><P> </P><P>Find your maximum and minimum for both x and y values.</P><P>Find the difference between your max-y and min-y. This will be 1 diameter (in y-direction)</P><P>Find the difference between your max-x and min-x. This will be the other diameter (in x-direction)</P><P> </P><P>If you subtract one of these differences from the other, you should get a (hopefully small) value.</P><P> </P><P>Edit: Oh wait, you mean if the ellipse is off to an angle..... then you are correct.</P><P>Let me see if I can think of a solution to that</P><DIV class="message-edit-history"><SPAN class="edit-author">Message Edited by Cory K on </SPAN><SPAN class="local-date"> 06-02-2009</SPAN><SPAN class="local-time"> 10:13 AM</SPAN></DIV>Tue, 02 Jun 2009 15:13:18 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918345#M413356Cory_K2009-06-02T15:13:18ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918352#M413361
You can just do a rotation of all the points (or the axes themselves. I've done something like this before. ) if you can figure out the angle. Then treat it like it's aligned properly.Tue, 02 Jun 2009 15:16:05 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918352#M413361elset1912009-06-02T15:16:05ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918358#M413364
<BLOCKQUOTE><HR />elset191 wrote: <BR />You can just do a rotation of all the points ... <HR /></BLOCKQUOTE><P>That sounds a little easier said than done. <img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.ni.com/i/smilies/16x16_smiley-very-happy.gif" alt="Smiley Very Happy" title="Smiley Very Happy" /></P><P>Is there an easy way to do that?</P>Tue, 02 Jun 2009 15:18:48 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918358#M413364Cory_K2009-06-02T15:18:48ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918363#M413365
<P>Mathematics -> Geometry -> 2D Cartesian Coordinate Rotation.</P><P> </P><P>Of course when I did it way back when I didn't know about this VI so wrote it myself. </P>Tue, 02 Jun 2009 15:22:27 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918363#M413365elset1912009-06-02T15:22:27ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918402#M413381
<P>Hi Cory,</P><P> </P><P>I think that with</P><P>Center x-value = [(max x-value)+(min x-value)] / 2</P><P>Center y-value = [(max y-value) + (min y-value)] / 2</P><P> </P><P>you wil calculate the center point of the minimum circumscribed <STRONG>BOX</STRONG>, not circle!</P><P>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 <span class="lia-unicode-emoji" title=":disappointed_face:">😞</span></P><DIV class="message-edit-history"><SPAN class="edit-author">Message Edited by Alain S on </SPAN><SPAN class="local-date"> 06-02-2009</SPAN><SPAN class="local-time"> 10:47 AM</SPAN></DIV>Tue, 02 Jun 2009 15:47:05 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918402#M413381Alain_S2009-06-02T15:47:05ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918770#M413520
<P>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.</P>Tue, 02 Jun 2009 22:00:04 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918770#M413520DSPGuy2009-06-02T22:00:04ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918916#M413570
<P>I found a way to calculate MCC <img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://forums.ni.com/i/smilies/16x16_smiley-surprised.gif" alt="Smiley Surprised" title="Smiley Surprised" /></P><P>Start the VI and.......................have a break <span class="lia-unicode-emoji" title=":slightly_smiling_face:">🙂</span></P><P> </P><P>So now I need a) a super computer or b) valuable data reduction</P><P>I'll go for the last one and also a way to find MIC & MZC, keep you posted guys ... ... ...</P><P> </P><P> </P><P>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 <span class="lia-unicode-emoji" title=":disappointed_face:">😞</span></P><P>Can you help a little bit more DSPGuy?</P><P> </P><P>Regards</P><P>Alain</P>Wed, 03 Jun 2009 05:40:58 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/918916#M413570Alain_S2009-06-03T05:40:58ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/919561#M413809
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. Wed, 03 Jun 2009 20:17:45 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/919561#M413809DSPGuy2009-06-03T20:17:45ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/919792#M413889
<P>Thanks DSPGuy for your efforts!</P><P>I'll have to install V8.6 first, I have the CD's somewhere but......... can't find them right now <img id="smileysad" class="emoticon emoticon-smileysad" src="https://forums.ni.com/i/smilies/16x16_smiley-sad.gif" alt="Smiley Sad" title="Smiley Sad" /></P><P> </P><P> </P><P>Forget about my version because there's an inadmissible error in the both centre point and radius.<BR />it looks good on a graph but when zooming in it isn't anymore <span class="lia-unicode-emoji" title=":disappointed_face:">😞</span></P><P>I have a dataset with known values for centerpoint and radius and the error I get is too large <span class="lia-unicode-emoji" title=":disappointed_face:">😞</span></P><P> </P><P>As soon as I have V8.6 installed I will test your code with the same dataset and let you know the outcome!</P><P> </P><P>Thanks for your help so far</P><P> </P><P>Regards</P><P>Alain</P>Thu, 04 Jun 2009 05:15:56 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/919792#M413889Alain_S2009-06-04T05:15:56ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/920366#M414089
Reposting code saved for LabVIEW 8.21. Thu, 04 Jun 2009 18:48:18 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/920366#M414089DSPGuy2009-06-04T18:48:18ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/920669#M414197
<P>Thanks for the "earlier" version but I already have 8.6 installed and translated to V8.5. I</P><P> also did some caculations. </P><P>A first sight it's ok but with some objects I don't get an answer for MIC or MCC or even both.</P><P>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.</P><P> </P><P>I'll make a vi with some datasets to explain the above.</P><P> </P><P>To be continued... ...</P>Fri, 05 Jun 2009 05:16:22 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/920669#M414197Alain_S2009-06-05T05:16:22ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/921084#M414333
<P>As promised a vi with some datasets that genereates errors instead of answers <img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://forums.ni.com/i/smilies/16x16_smiley-surprised.gif" alt="Smiley Surprised" title="Smiley Surprised" /></P><P>I'll have a closer look at that vi in the week-end ...</P>Fri, 05 Jun 2009 15:54:37 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/921084#M414333Alain_S2009-06-05T15:54:37ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/921501#M414495
<P>Me again <span class="lia-unicode-emoji" title=":slightly_smiling_face:">🙂</span> </P><P> </P><P>I tried to implement MZC calculations </P><P>MZC is Minimum Zone Circle, two concentric circles that just enclose the profile on both outside and inside. </P><P> </P><P>Now I have 4 elements in array X: circles centre X, circles centre Y, radius outer circle, radius inner circle. Because of this 4 elements Xminimum and X maximum in cluster Bounds also need 4 elements. </P><P> </P><P>In this case I have two constraints, so I put them in the array “Inequality constraint…” </P><P>It’s strange that I don’t need to add an element in the array “Inequality constraint min” and “Inequality constraint max” in the “Bounds” cluster, just like the “X” case above. Even strange is the fact that I get different results depending in the number of elements in those “Inequality” arrays? </P><P> </P><P>What is the “Objective function value” for and what should I wire there? </P><P>Now I used the difference between outer radius and inner radius since this is the MZC, but is this correct? </P><P>Why do you square and sum this array? </P><P> </P><P>I’m sure this is close but not correct since when I run it on some profiles I have, those MZC circles are close to the profile but never touch it. </P><P> </P><P>So can you please advice a little more? </P><P>Thanks a lot </P><P>Regards </P><P>Alain </P>Sat, 06 Jun 2009 17:31:48 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/921501#M414495Alain_S2009-06-06T17:31:48ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/922232#M414731
<P>MZC is also working fine now <img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.ni.com/i/smilies/16x16_smiley-very-happy.gif" alt="Smiley Very Happy" title="Smiley Very Happy" /></P><P>Updated version attached </P><P> </P><P>Thanks DSPGuy (aka Jim, yes I read a lot this week-end <img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://forums.ni.com/i/smilies/16x16_smiley-tongue.gif" alt="Smiley Tongue" title="Smiley Tongue" /> ) you learned me a lot!</P><P> </P><P>Regards</P><P>Alain</P>Mon, 08 Jun 2009 18:42:24 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/922232#M414731Alain_S2009-06-08T18:42:24ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/1721610#M606357
<P>Hi, I'm also trying to write this roundness program, and this thread has been extremely helpful. </P>
<P> </P>
<P>A question I have is...why did you use the X&Y graph instead of a polar plot? and how would you write this using a polar plot? I'm having a difficult time implementing a polar plot</P>
<P> </P>
<P>Thanks for your help</P>Wed, 28 Sep 2011 18:18:54 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/1721610#M606357Roundess2011-09-28T18:18:54ZRe: Roundness calculations
https://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/1724318#M606828
<P>Hello,</P>
<P> </P>
<P>Is there a specific reason why it needs to be a polar graph?</P>
<P> </P>
<P>Can you post the code you already have?</P>Fri, 30 Sep 2011 14:26:50 GMThttps://forums.ni.com/t5/LabVIEW/Roundness-calculations/m-p/1724318#M606828ThiCop2011-09-30T14:26:50Z