[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: pcjc2 tessellation
On 16/05/11 19:26, Peter Clifton wrote:
On Mon, 2011-05-16 at 15:54 +1000, Russell Shaw wrote:
From pcjc2/src/borast/borast-bentley-ottmann.c, i used some functions
to make a small test program to see how bo_contour_to_traps() works.
The code is mostly stolen from cairo, then stripped down to a bare
minumum (e.g. doesn't deal with intersections in contours, as PCB
polygons don't have them).
Hi,
I've looked in cairo before but never much got the hang of it
in detail.
I'd be interested to know what you're working on. Please let me know if
you spot anything stupid in the borast/ code, I've not completely
cleaned the interfaces up ready for merging yet. (The abstraction
between them and PCB is not particularly clean).
I've always been interested in CAD programs and thought of making
a schematic/pcb one from scratch.
One thing i'm eternally conflicted with is relying on video-card
hardware that is closed source.
The problem with the free drivers is that when you send it polygons,
it could end up software rendering them, and you have no way of knowing
in advance if the performance will totally suck.
If you just generate pixels from scanline rendering in software,
this can be done directly from a list of arbitrarily intersecting
lines without requiring the bentley-ottmann polygon generator step.
You generate the whole window pixmap yourself and send that to the
screen.
Using this, i could avoid openGL. However, if an open hardware
accelerated openGL came along i was happy with, then i would need
to use the bentley-ottmann step to generate polygons, but i don't
understand that bit of code in detail, even though i've read the
paper. If i understood it in detail, then i could look closer at
how pcjc2 works and maybe improve something.
See suggestion inline with the code:
In bo_contour_to_traps(), i get num_events = contour->Count = 0,
so i must be missing something. Here's the test i was trying:
void
borast(void)
{
Vector v;
v[0] = 0; // x
v[1] = 0; // y
PLINE *contour = poly_NewContour(v);
v[0] = 1; // x
v[1] = 0; // y
VNODE *node = poly_CreateNode(v);
VNODE *after =&contour->head;
poly_InclVertex(after, node);
v[0] = 1; // x
v[1] = 1; // y
VNODE *node2 = poly_CreateNode(v);
poly_InclVertex(node, node2);
After the last vertex in a contour, you need to finish "preparing" the
contour, with a call to:
poly_PreContour (contour, TRUE); /* TRUE turns optimisation for redundant nodes on, FALSE should work too */
This calculates the contour's area, figures out what order you defined
the edges in (winding order), and constructs an r-tree of the edges (to
make the contour participate faster in boolean operations)
borast_traps_t traps;
bo_contour_to_traps(contour,&traps);
}
Thanks muchly:)
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user