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:
parent
7b54293bff
commit
378aab025f
16
cameo/path.c
16
cameo/path.c
@ -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 &&
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user