polygon clipping


Id like an explanation on the Z clipping stuff showed in the book " cutting edge 3d game programming with c++". Heres the scoop:

we have 2 points at coors <1,1,1> and <2,1,2> ( lets call em A and B) and theres a vector from the one to the other. somewhere between them, there is a plane called C that any degenerate vertices are supposed to be clipped to. The A point is degenerate and needs to be clipped. to perform the clipping, you shall do the following operation: P = (Bz - C) / ( Bz - Az)

the P means percent of the line that is in the "forbidden area", that is BEHIND the Z clipping plane.

then, to get the coord of the Ac ( the clipped Ax ) you are supposed to do the following:

Ac = Ax + P( Bx - Ax )

and thats IT. BUT, what i need to KNOW is how to handle the expression: P( Bx - Ax )

I have tried to do the P of Bx and Ax, multiply P by ( Bx - Ax ) AND tried to add them to each other, but I dont get the right answer ( I know becaouse Ive tried with paper and pencil, and none of the answers the other methods give me make sense with what the Ac coords SHOULD be. I ASSUME that C = 1.5 because its between A and B. The book doesnt give any hint to where i could place the C plane. HALP!

An answer would be MORE than great.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!