#include "gfxtools.h"
#include "gfxpoly.h"
#include "mem.h"
+#ifdef INTERNAL_LIBART
#include "art/libart.h"
#include "art/art_svp_intersect.h"
#include "art/art_svp_ops.h"
+#else
+#include <libart_lgpl/libart.h>
+#include <libart_lgpl/art_svp_intersect.h>
+#include <libart_lgpl/art_svp_ops.h>
+#endif
#include "log.h"
#include <assert.h>
#include <memory.h>
pos = 0;
l2 = line;
+ int lastmove=-1;
while(l2) {
if(l2->type == gfx_moveTo) {
vec[pos].code = ART_MOVETO_OPEN;
vec[pos].x = l2->x;
vec[pos].y = l2->y;
+ lastmove=pos;
pos++;
assert(pos<=len);
} else if(l2->type == gfx_lineTo) {
}
x = l2->x;
y = l2->y;
+
+ /* let closed line segments start w/ MOVETO instead of MOVETO_OPEN */
+ if(lastmove>=0 && l2->type!=gfx_moveTo && (!l2->next || l2->next->type == gfx_moveTo)) {
+ if(vec[lastmove].x == l2->x &&
+ vec[lastmove].y == l2->y) {
+ assert(vec[lastmove].code == ART_MOVETO_OPEN);
+ vec[lastmove].code = ART_MOVETO;
+ }
+ }
+
l2 = l2->next;
}
vec[pos++].code = ART_END;
}
/* Find adjacent identical points. If an ajdacent pair of identical
- points is found, the second is removed.
+ points is found, the second one is removed.
So moveto x,y lineto x,y becomes moveto x,y
lineto x,y lineto x,y becomes lineto x,y
lineto x,y moveto x,y becomes lineto x,y
}
if(!fail)
break;
- v = lrand48() / 2000000000.0;
+#ifdef HAVE_LRAND48
+ v = lrand48() / 2000000000.0;;
+#elif HAVE_RAND
+ v = rand() / 2000000000.0;
+#else
+#error "no lrand48()/rand() implementation found"
+#endif
tries++;
}
return v;
{
if(!svp)
return;
- printf("writing %s\n", filename);
FILE*fi = fopen(filename, "wb");
int i, j;
double xmin=0,ymin=0,xmax=0,ymax=0;
//#endif
-
-extern const ArtSVP* current_svp;
-extern void art_report_error();
-extern int art_error_in_intersector;
-
ArtSVP* run_intersector(ArtSVP*svp, ArtWindRule rule)
{
ArtSvpWriter * swr = art_svp_writer_rewind_new(rule);