View Full Version : Converting plane co-ordinates into vectors

Zeus_666

07-09-2001, 02:54 AM

Hi,

I have a set of plane co-ordinates:

( 192 64 0 ) ( 64 64 0 ) ( 64 -64 0 )

( 64 -64 8 ) ( 64 64 8 ) ( 192 64 8 )

( 64 -64 8 ) ( 192 -64 8 ) ( 192 -64 0 )

( 192 -64 8 ) ( 192 64 8 ) ( 192 64 0 )

( 192 64 8 ) ( 64 64 8 ) ( 64 64 0 )

( 64 64 8 ) ( 64 -64 8 ) ( 64 -64 0 )

and i need to convert these into vectors so that i can draw a cube. Can anyone help.

Thanks

DFrey

07-09-2001, 04:29 AM

I suppose you are taking these planes from the QuakeIII .map format. If that's the case then what you have to do to get the vertices of the brush, is intersect all of those planes. Rememeber, when two non-coplanar planes intersect, they do so in a line, when three intersect, they do so at a point. So you have to find all the possible points by intersecting the planes with one another. Then you have to examine each resulting point to see if it is "in front" of any one of the planes. If a point is "in front" of any one of the planes, then that point is not part of the brush. This produces a final set of points, the vertices of the brush.

So then, for each plane of the brush, you intersect it with the vertices to see which vertices lie in that plane. (This can be easier done if you link (or map) the vertices to their planes as they are calculated). Now knowing which points lie in which plane, you can calculate the face winding for each plane, and tessellate as needed.

[This message has been edited by DFrey (edited 07-09-2001).]

DFrey

07-09-2001, 04:36 AM

Also note, you can not assume that any of the points in the plane definitions from the map file are themselves vertices of the brush. Some may be, others may not, and none have to be.

Zeus_666

07-09-2001, 05:10 AM

Hi,

Thanks for the reply but my maths is not all that good, if you or someone could either explain the maths to me or show me some code i would be most grateful.

Thanks

Zeus_666

07-10-2001, 03:41 AM

How do you calculate all the points given several sets?

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.