|
worldcraft .map file and 4. coordinate
The following data is from a worldcraft .map file. It describes a cube (16x16x16).
How do i calculate the 4. coordinate so I can draw a polygon?
Edited by - soreno on January 10, 2002 4:45:01 AM
glBegin(GL_POLYGON);
//front
glVertex3f( 8, 8, 8);
glVertex3f( 8,-8, 8);
glVertex3f(-8,-8, 8);
glVertex3f(-8, 8, 8);
glEnd();
I''m not sure, but:
x y
+ +
+ -
- -
- + <-- isn''t it a logical idea
//front
glVertex3f( 8, 8, 8);
glVertex3f( 8,-8, 8);
glVertex3f(-8,-8, 8);
glVertex3f(-8, 8, 8);
glEnd();
I''m not sure, but:
x y
+ +
+ -
- -
- + <-- isn''t it a logical idea
yes, but what about the other faces..?
I got 3 vertices and need an algorihtm that calculates the 4.
I got 3 vertices and need an algorihtm that calculates the 4.
let me try
CVector v1,v2,v3,v4;
v1=CVector( 8.f, 8.f, 8.f);
v2=CVector( 8.f,-8.f, 8.f);
v3=CVector(-8.f,-8.f, 8.f);
v4=(v1+v3)*0.5f + ( (v1+v3)*0.5f - v2 );
/*
x4=(x1+x3)*0.5f + ( (x1+x3)*0.5f - x2 );
y4=(y1+y3)*0.5f + ( (y1+y3)*0.5f - y2 );
z4=(z1+z3)*0.5f + ( (z1+z3)*0.5f - z2 );
*/
this would be the way I''d do it. (hope there are no bugs)
CVector v1,v2,v3,v4;
v1=CVector( 8.f, 8.f, 8.f);
v2=CVector( 8.f,-8.f, 8.f);
v3=CVector(-8.f,-8.f, 8.f);
v4=(v1+v3)*0.5f + ( (v1+v3)*0.5f - v2 );
/*
x4=(x1+x3)*0.5f + ( (x1+x3)*0.5f - x2 );
y4=(y1+y3)*0.5f + ( (y1+y3)*0.5f - y2 );
z4=(z1+z3)*0.5f + ( (z1+z3)*0.5f - z2 );
*/
this would be the way I''d do it. (hope there are no bugs)
Could it be the following ?
Vertex A : xa, ya, za
Vertex B : xb, yb, zb
Vertex C : xc, yc, zc
Vertex D : xc+xb-xa, yc+yb-ya, zc+zb-za
so that AB = DC (vectors I mean).
Vertex A : xa, ya, za
Vertex B : xb, yb, zb
Vertex C : xc, yc, zc
Vertex D : xc+xb-xa, yc+yb-ya, zc+zb-za
so that AB = DC (vectors I mean).
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
Oops ! I meant :
Vertex D : xc+xa-xb, yc+ya-yb, zc+za-zb
Rod.
Vertex D : xc+xa-xb, yc+ya-yb, zc+za-zb
Rod.
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
Oops ! I meant :
Vertex D : xc+xa-xb, yc+ya-yb, zc+za-zb
Rod.
Vertex D : xc+xa-xb, yc+ya-yb, zc+za-zb
Rod.
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
Oops ! I meant :
Vertex D : xc+xa-xb, yc+ya-yb, zc+za-zb
Rod.
Vertex D : xc+xa-xb, yc+ya-yb, zc+za-zb
Rod.
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
.map files dont store poly vertices, they store 3 points on a plane. Where the 3 plane cross, a vertice exists. Build your polys from those.
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement