EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bug Reports (https://www.eqemulator.org/forums/forumdisplay.php?f=591)
-   -   Azone utility bug: Faces that intersect a node but have no vertices in that node (https://www.eqemulator.org/forums/showthread.php?t=23970)

Derision 12-12-2007 11:02 PM

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:

http://www.rama.demon.co.uk/nodeface.png

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.

http://www.rama.demon.co.uk/lines_cross.png

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))



All times are GMT -4. The time now is 03:29 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.