[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: pcb circles turn into hexagons
On Thu, 2009-11-05 at 04:39 +0000, Kai-Martin Knaak wrote:
> With recent pcb versions real circles turn into hexagons when zoomed out:
> http://bibo.iqo.uni-hannover.de/dokuwiki/lib/exe/fetch.php?cache=&media=wiki:pcb-gl_small_circles.png
> Note, that circles which were composed by four 90° arcs still look fine
> at the same zoom.
Is this the GL branch?
If so, you might want to adjust this parameter:
In src/hid/common/hidgl.c:
Search for "#define MIN_TRIANGLES_PER_CIRCLE 6"
or "#define PIXELS_PER_CIRCLINE 5."
And change those numbers.
MIN_SLICES_PER_ARC is defined as 6, so you get minimum 24 edges for
items composed of four arcs. (Yes, I probably should have scaled this by
swept angle).
The equation used to determine how many triangles to use in a circle is:
slices = M_PI * 2 * vr / scale / PIXELS_PER_CIRCLINE;
vr is radius, in internal PCB coordinates.
scale is a conversion factor to pixels (IIRC!)
So, it is working out the circumference of the circle (in pixels -
floating point), then dividing it up such that each triangle edge on the
outer of the circle is approximately PIXELS_PER_CIRCLINE long:
____
/\ /\ \____ Define the length of this edge as PIXELS_PER_CIRCLINE
/__\/__\ \
\ /\ /
\/__\/
That didn't work so well for really big, or really small triangles, so I
added a clamp at both ends. (Current code is MIN: 6, MAX: 360 slices)
Perhaps there is a smarter way to compute the number in the first place?
Better clamp values?
Suggestions (______especially in the form or a patch______) are welcome.
Just a note, polygons always use 36 lines to approximate a circle - that
isn't always ideal. I'm going to change it to 40 at some point - to
introduce 8 fold symmetry - which for various reasons, speeds up polygon
clipping on boards with lines meeting at 45 degrees.
I don't think the fixed 35 or 40 approximation is ideal though.. when
zoomed out, it is far too detailed. When zoomed in, you can see that the
object is not circular.
Best wishes,
Peter C.
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user