mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 04:13:20 +02:00
poly2d/: simplify semantics of first/next offset in area fill
This commit is contained in:
parent
46c8f8653c
commit
a950c5b13c
@ -43,7 +43,6 @@ Not yet specified:
|
||||
Other:
|
||||
- change the license from GPL to LGPL
|
||||
- transform CGAL's idea of outer polygons into something we can use
|
||||
- use more meaningful offset/overlap model for area fill
|
||||
- check for memory leaks
|
||||
- try to generate dependencies also for *.cpp
|
||||
|
||||
|
@ -32,13 +32,13 @@ static void recurse_area(struct p2d_hier *t, double offset, double overlap,
|
||||
}
|
||||
|
||||
|
||||
struct p2d *p2d_area(const struct p2d *p, double offset, double overlap)
|
||||
struct p2d *p2d_area(const struct p2d *p, double first, double next)
|
||||
{
|
||||
struct p2d_hier *t;
|
||||
struct p2d *res = NULL, **last = &res;
|
||||
|
||||
t = p2d_hsort(p);
|
||||
recurse_area(t, offset, overlap, &last);
|
||||
recurse_area(t, first, next, &last);
|
||||
p2d_hier_free(t);
|
||||
return res;
|
||||
}
|
||||
|
@ -52,17 +52,17 @@ static void append_poly(Polygon_2 poly, struct p2d ***last)
|
||||
}
|
||||
|
||||
|
||||
static void recurse_area(Polygon_with_holes poly, double curr_off,
|
||||
double next_off, struct p2d ***last)
|
||||
static void recurse_area(Polygon_with_holes poly, double current,
|
||||
double next, struct p2d ***last)
|
||||
{
|
||||
PolygonPtrVector tmp =
|
||||
CGAL::create_interior_skeleton_and_offset_polygons_with_holes_2(
|
||||
curr_off, poly);
|
||||
current, poly);
|
||||
|
||||
for (PolygonPtrVector::const_iterator pit = tmp.begin();
|
||||
pit != tmp.end(); ++pit) {
|
||||
append_poly((*pit)->outer_boundary(), last);
|
||||
recurse_area(**pit, next_off, next_off, last);
|
||||
recurse_area(**pit, next, next, last);
|
||||
|
||||
for (Polygon_with_holes::Hole_const_iterator
|
||||
hit = (*pit)->holes_begin();
|
||||
@ -74,7 +74,7 @@ static void recurse_area(Polygon_with_holes poly, double curr_off,
|
||||
|
||||
|
||||
extern "C" void p2d_area_holes_append(const struct p2d *p,
|
||||
const struct p2d *holes, double offset, double overlap,
|
||||
const struct p2d *holes, double first, double next,
|
||||
struct p2d ***last)
|
||||
{
|
||||
const struct p2d *h;
|
||||
@ -87,15 +87,15 @@ extern "C" void p2d_area_holes_append(const struct p2d *p,
|
||||
poly.add_hole(p2d_to_P2(h, 0));
|
||||
}
|
||||
|
||||
recurse_area(poly, offset, offset-overlap, last);
|
||||
recurse_area(poly, first, next, last);
|
||||
}
|
||||
|
||||
|
||||
extern "C" struct p2d *p2d_area_holes(const struct p2d *p,
|
||||
const struct p2d *holes, double offset, double overlap)
|
||||
const struct p2d *holes, double first, double next)
|
||||
{
|
||||
struct p2d *res = NULL, **last = &res;
|
||||
|
||||
p2d_area_holes_append(p, holes, offset, overlap, &last);
|
||||
p2d_area_holes_append(p, holes, first, next, &last);
|
||||
return res;
|
||||
}
|
||||
|
@ -127,11 +127,11 @@ struct p2d *p2d_offset_holes(const struct p2d *p, const struct p2d *holes,
|
||||
struct p2d *p2d_offset(const struct p2d *p, double off);
|
||||
|
||||
void p2d_area_holes_append(const struct p2d *p,
|
||||
const struct p2d *holes, double offset, double overlap,
|
||||
const struct p2d *holes, double first, double next,
|
||||
struct p2d ***last);
|
||||
struct p2d *p2d_area_holes(const struct p2d *p, const struct p2d *holes,
|
||||
double offset, double overlap);
|
||||
struct p2d *p2d_area(const struct p2d *p, double offset, double overlap);
|
||||
double first, double next);
|
||||
struct p2d *p2d_area(const struct p2d *p, double first, double next);
|
||||
|
||||
struct p2d *p2d_read_gnuplot(FILE *file);
|
||||
int p2d_write_gnuplot(FILE *file, const struct p2d *p);
|
||||
|
@ -12,7 +12,7 @@ p2d_append(p, v2d_new(5.5, 0));
|
||||
p2d_append(p, v2d_new(5.5, 4.5));
|
||||
p2d_append(p, v2d_new(0, 4.5));
|
||||
p2d_close(p);
|
||||
q = p2d_area(p, 1, 0);
|
||||
q = p2d_area(p, 1, 1);
|
||||
p2d_write_gnuplot_all(stdout, q);
|
||||
EOF
|
||||
|
||||
@ -42,7 +42,7 @@ p2d_append(p, v2d_new(5.5, 0));
|
||||
p2d_append(p, v2d_new(5.5, 4.5));
|
||||
p2d_append(p, v2d_new(0, 4.5));
|
||||
p2d_close(p);
|
||||
q = p2d_area(p, 1, 0.3);
|
||||
q = p2d_area(p, 1, 0.7);
|
||||
p2d_write_gnuplot_all(stdout, q);
|
||||
EOF
|
||||
|
||||
@ -81,7 +81,7 @@ p2d_append(p, v2d_new(18, 8));
|
||||
p2d_append(p, v2d_new(18, 2));
|
||||
p2d_close(p);
|
||||
|
||||
q = p2d_area(pl, 0.7, 0);
|
||||
q = p2d_area(pl, 0.7, 0.7);
|
||||
p2d_write_gnuplot_all(stdout, q);
|
||||
EOF
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user