mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2025-01-03 19:50:15 +02:00
slicer/slice.c (add): detect and report inclined facets
This commit is contained in:
parent
c984021251
commit
a30024dce1
@ -71,17 +71,26 @@ static void mark_z(float z)
|
||||
|
||||
static void add(const struct v *a, const struct v *b, const struct v *c)
|
||||
{
|
||||
float cross;
|
||||
struct z *z;
|
||||
struct line *line;
|
||||
|
||||
/* @@@ should check that C is above AB */
|
||||
|
||||
if (eq(a->x, b->x) && eq(a->y, b->y)) {
|
||||
fprintf(stderr, "zero point\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->z < a->z)
|
||||
return;
|
||||
|
||||
cross = (b->x - a->x) * (c->y - a->y) - (b->y - a->y) * (c->x - a->x);
|
||||
if (!eq(cross, 0)) {
|
||||
fprintf(stderr,
|
||||
"inclined facet\n\t%f %f %f\n\t%f %f %f\n\t%f %f %f\n",
|
||||
a->x, a->y, a->z, b->x, b->y, b->z, c->x, c->y, c->z);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
z = get_z(a->z);
|
||||
line = alloc_type(struct line);
|
||||
line->ax = a->x;
|
||||
|
Loading…
Reference in New Issue
Block a user