LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Picture Control - Drawing radius border on an arc doesn't align

I am trying to draw a bunch of filled arcs (pie slices) in a circle or ellipse and then draw the borders (radius) between the arcs.

 

No matter how I fiddle with the integers and math I can't get the line to consistently follow the edge of the filled arc.

 

Does anyone know the algorithm used to draw the filled arc in a picture control?  Specifically, I would like to determine the coordinates of the three "corners."

 

Thanks!

0 Kudos
Message 1 of 3
(2,580 Views)

One issue that you have is that your rectangle has even number of pixel rows and columns. Change the right and bottom values to 506 and you will now have a center pixel. Of course because of the transformation dbl to I16 there still might be a 1 pixel offset for some line, changing the line pen width to 2 will cover this offset if you can live with the result.

 

Ben64

0 Kudos
Message 2 of 3
(2,561 Views)

I think if Left is 5 and Right is 505, there should be a center pixel, unless (5,505) is not inclusive of both edges.  Regardless, the arc algorithm has to account for an even number of pixels so I should be able to do the same thing if I know how it's done.

 

Strangley, even the series of filled arcs and the circle drawn within the same rectangle don't line up.  You can see this by observing red and green pixels outside of the blue circle.  It turns out that even drawing the filled arcs and then overwriting with unfilled arcs yields different outer circles - the filled arc bleeds outside the unfilled arc.

 

It looks like the filled arc function is messy and not useful in this case.  That's a bummer because filling in the arcs might prove complex and time consuming compared with using the built-in opcode.

0 Kudos
Message 3 of 3
(2,515 Views)