[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).

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).

In poly_PreContour(), the sign of the winding area is found by
summing the area of each box formed by consecutive points. It is
not clear if this method is valid. Is there a reference paper?

  double area = 0;
  do {
    area += (double) (p->point[0] - c->point[0]) * (p->point[1] +

I think better if:

  int area = 0;
  do {
    area += p->point[0]*c->point[1] - c->point[0]*p->point[1];

    /* http://en.wikipedia.org/wiki/Polygon#Area_and_centroid */

because it calculates the total winding area of a polygon.

geda-user mailing list