1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-22 23:04:16 +02:00

cameo/path.c: new function path_is_inside which calls p2d_contains_poly

This commit is contained in:
Werner Almesberger 2012-06-12 15:04:59 -03:00
parent 7b54293bff
commit 378aab025f
2 changed files with 17 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include "util.h"
#include "shape.h"
#include "poly2d.h"
#include "path.h"
@ -390,6 +391,21 @@ const struct path *path_find_leftmost(const struct path *path)
}
int path_is_inside(const struct path *a, const struct path *b)
{
struct p2d *pa, *pb;
int res;
pa = path_to_poly(a);
pb = path_to_poly(b);
res = p2d_contains_poly(pb, pa);
p2d_free(pa);
p2d_free(pb);
return res == 1; /* 0 if they intersect */
}
static int attr_eq(const struct path *a, const struct path *b)
{
return a->r_tool == b->r_tool && a->outside == b->outside &&

View File

@ -38,6 +38,7 @@ int path_is_closed(const struct path *path);
int path_tool_is_left(const struct path *path);
struct path *path_offset(const struct path *path, int left, int notch);
const struct path *path_find_leftmost(const struct path *path);
int path_is_inside(const struct path *a, const struct path *b);
void path_free(struct path *path);
struct path *path_connect(struct path *path);
void path_stats(const struct path *path);