View Single Post
  #1  
Old 12-12-2007, 11:02 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default Azone utility bug: Faces that intersect a node but have no vertices in that node

I've run across a couple of small bugs in the azone utility which
means that some faces which intersect a node, but don't have any
vertices in that node, will not be included in the facelist for
that node.

E.g. in the case shown in this picture:



The first bug is in one of the GPoint constructors:

azone.cpp, Line 1155:

Change:

Code:
GPoint::GPoint(float x, float y, float z) {
        x = x;
        y = y;
        z = z;
}
to

Code:
GPoint::GPoint(float nx, float ny, float nz) {
        x = nx;
        y = ny;
        z = nz;
}
The second bug is in the edges_cross function. Take the following
example of two lines which intersect.



The following code illustrates the bug, it returns FALSE:

Code:
        GPoint p1(100,100,0), p2(100,300,0);
        VERTEX p3, p4;
        p3.x=300;p3.y=200;p3.z=0;
        p4.x=50;p4.y=200;p4.z=0;
        printf("edges_cross returns %d\n", edges_cross(&p1,&p2,&p3,&p4));
The fix is to change:

azone.cpp, Line 868:

from
Code:
#define CoordOnLine(p1, p2, coord, dim) \
 (p1->dim > p2->dim? (coord > p2->dim && coord < p1->dim) : (coord > p1->dim && coord < p2->dim))
to

Code:
#define CoordOnLine(p1, p2, coord, dim) \
 (p1->dim > p2->dim? (coord >= p2->dim && coord <= p1->dim) : (coord >= p1->dim && coord <= p2->dim))
Reply With Quote