LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Draw Arc VI confusion

I am trying to use the Draw Arc VI to draw arcs (filled in) at different degree values, starting from zero, but can't get it to work like I expect it should at 1 or 2 degrees.  Rather than drawing a 1 or 2 degree sliver, the VI draws an entire semicircle.  It seems to work fine at any other degree value, including -1 and -2 degrees.  Attached is a simple VI to demonstrate what I am seeing.  Just enter a 1 or 2 in the numeric control and run it.  The VI was built in LV 8.2.
0 Kudos
Message 1 of 11
(4,690 Views)

"superclark" <x@no.email> wrote in message news:1161726008095-431912@exchange.ni.com...
I am trying to use the Draw Arc VI to draw arcs (filled in) at different degree values, starting from zero, but can't get it to work like I expect it should at 1 or 2 degrees.&nbsp; Rather than drawing a 1 or 2 degree sliver, the VI draws an entire semicircle.&nbsp; It seems to work fine at any other degree value, including -1 and -2 degrees.&nbsp; Attached is a simple VI to demonstrate what I am seeing.&nbsp; Just enter a 1 or&nbsp;2 in the numeric control and run it.&nbsp; The VI was built in LV 8.2.



Draw Arc Confusion.vi:
http://forums.ni.com/attachments/ni/170/211983/1/Draw Arc Confusion.vi




Hi,


This is a bug. Notice that it only happens if the size is less then a certain value, or slightly bigger and even!


A size 114, 112, 110, 108 shows the bug, a size of 109, 111 or 112 doesn't, nor do sizes bigger then 115. (This is in LV7.1, but I imagine not much has changed in LV8.2, 0 to 1 degree).


For 0 - 2 degree, the problem occurs at roughly half the size (only horizontal size seem to matter):


0 - 5 degree :sizes <12, even numbers from 12 up to 22
0 - 4 degree :sizes <14, even numbers from 14 up to 28
0 - 3 degree :sizes <20, even numbers from 20 up to 38
0 - 2 degree :sizes <28, even numbers from 28 up to 56
0 - 1 degree :sizes <58, even numbers from 58 up to 114


So it has to be some sort of rounding bug. 1 degree gets rounded to 0 in some cases (if scale is to small, with some even/uneven side effects), and 0 - 0 is then regarded as the default value, so a full circle is used.


As a simple workaround you could make the arc size larger (larger then 114). Or draw the arc flipped. No problem if you draw from 0 with arc size -1.


If this is not possible, you'll have to check (with a lookup table?) if the problem occurs, and if so, draw a line instead.


You could try to find a formula that has the some effect to tell if the problem occurs, but it won't be easy (probably with conversion from degrees to radians, or from angle to x possition). It might be easier to just always draw a line if drawing from 0 to 4 and size <29, or 0 to 3 <39 and so on.


It's not the only bug. A full circle is also drawn if start angle = 1 and arc size = -1, 2 and -2 (but not 1, -2 or 2, -1!). I tried to draw an arc from 1, size -1 instead of an arc from 0 to 1, but than won't fix the problem.


Regards,


Wiebe.




0 Kudos
Message 2 of 11
(4,681 Views)
Thanks for the reply.  At least now I know it wasn't entirely my fault.  I guess i'll just have to come up with a workaround.  Thanks again!
0 Kudos
Message 3 of 11
(4,675 Views)
Might be easier to use a pie chart in excel.
0 Kudos
Message 4 of 11
(4,672 Views)

Here is a thread with some excel charts. Maybe you could make the rest of the pie sections white like the background.

http://forums.ni.com/ni/board/message?board.id=170&message.id=189844&view=by_date_ascending&page=2

0 Kudos
Message 5 of 11
(4,668 Views)

This came up in my search for 'draw arc 1 degree' because I was having the same problem.  Did this ever get filed as a bug report?  It happens in 8.2 and 8.5 (don't have 8.5.1 installed to check.  I am just drawing an arc of 1 degree size with a start point of 0 and I get a full circle.  quite undesired

0 Kudos
Message 6 of 11
(4,440 Views)

SuperClark,

I noticed while running your example vi, that if I increase the size of the picture and re run the vi, the problem vanishes.

Tobin

0 Kudos
Message 7 of 11
(4,431 Views)
Yeah, it looks like a rounding issue
0 Kudos
Message 8 of 11
(4,427 Views)

I want to draw a arc for some degree at a defined center point. For ex : If I choose Draw Circle then there is an option to define the center point called PIXEL CENTER, In this Control I can define Horizontal and Vertical Pixel Value. But in Draw Arc doesn't have this Option. How can I Define.??

 

Regards

Gokul

0 Kudos
Message 9 of 11
(3,775 Views)

Hi gokul2013, 

 

I advise you to place this in a new thread because it will get more traffic.  In future posts you should always make a new thread and refer them on that thread to an older related thread.  This will make sure this forum is posted on the front pages of the forums.

Peter T
Applications Engineer
National Instruments
0 Kudos
Message 10 of 11
(3,717 Views)