mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 03:02:25 +02:00
poly2d/: store actual values in struct f2d, not pointers
... since the data structures they point to have internal use only.
This commit is contained in:
parent
8b6e4168d3
commit
626dbe52e1
@ -186,31 +186,40 @@ static struct f2d *make_face(CDT::Finite_faces_iterator fit,
|
||||
const struct p2d *p, const struct p2d *holes)
|
||||
{
|
||||
struct f2d *f;
|
||||
const struct v2d *v[3];
|
||||
const struct p2d *h;
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
f = alloc_type(struct f2d);
|
||||
for (i = 0; i != 3; i++) {
|
||||
Point point = fit->vertex(i)->point();
|
||||
const struct v2d *m;
|
||||
|
||||
m = find_point(p, point.x(), point.y());
|
||||
if (m) {
|
||||
f->v[i] = m;
|
||||
f->p[i] = p;
|
||||
v[i] = m;
|
||||
continue;
|
||||
}
|
||||
for (h = holes; h; h = h->next) {
|
||||
m = find_point(h, point.x(), point.y());
|
||||
if (!m)
|
||||
continue;
|
||||
f->v[i] = m;
|
||||
f->p[i] = h;
|
||||
v[i] = m;
|
||||
break;
|
||||
}
|
||||
assert(m);
|
||||
}
|
||||
|
||||
f = alloc_type(struct f2d);
|
||||
for (i = 0; i != 3; i++) {
|
||||
f->x[i] = v[i]->x;
|
||||
f->y[i] = v[i]->y;
|
||||
j = i+1;
|
||||
if (j == 3)
|
||||
j = 0;
|
||||
f->side[i] = v[i]->next == v[j] || v[j]->next == v[i];
|
||||
}
|
||||
f->next = NULL;
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifndef POLY2D_H
|
||||
#define POLY2D_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@ -30,8 +31,9 @@ struct p2d {
|
||||
};
|
||||
|
||||
struct f2d {
|
||||
const struct v2d *v[3]; /* vertices forming the face */
|
||||
const struct p2d *p[3]; /* polygons vertices belong to */
|
||||
double x[3]; /* vertices forming the face */
|
||||
double y[3];
|
||||
bool side[3]; /* side[i] if v[i] and v[(i+1) mod 3] are on polygon */
|
||||
struct f2d *next;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user