I am looking through someone else's code and I am having a hard time figuring out a how a certain data structure works. This program loads in an array of faces and edges, and I need to render these faces to the screen. However, the faces array doesn't contain any vertex information. It looks like this:
struct CollisionFace
{
Plane p; // plane equation of face is r.n + k = 0
short edge[3]; // edges around face. if edge is +ve then
// this face is face[0] in the edge structure.
// if negative then & 0x7fff to get the edge number,
// and the face is face[1]
};
struct CollisionEdge
{
US face[2]; // 2 faces (second face == 0xffff for outside egde)
union {
struct {
float a, b, c; // ax + by + c = 0 on edge
}; // ax + by + c = +ve for face[0]
float eq[3];
};
};
The data for the first face looks like this:
Plane.Normal = -0.3, 0.7, 0.5
Plane.K = -64.0
Then the 3 Edges for this face looks like this:
Edge[0].a = 0.99
Edge[0].b = -0.18
Edge[0].c = -116.6
Edge[1].a = -0.85
Edge[1].b = -0.52
Edge[1].c = 169.2
Edge[2].a = -0.45
Edge[2].b = 0.89
Edge[2].c = -33.3
I know it may be hard to understand this just by looking at 1 set of values, but I'm stuck on this and I'm hoping there's someone out there who understands this a lot better than I do. I just need to render this face to the screen, but in order to do that I need to get the 3 vertices for it.
Thanks!











