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). 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). 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); > } -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) Tel: +44 (0)1223 748328 - (Shared lab phone, ask for me)
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ geda-user mailing list geda-user@xxxxxxxxxxxxxx http://www.seul.org/cgi-bin/mailman/listinfo/geda-user