View Full Version : HOW TO CREATE 3D MODEL FROM 2D HORIZENTAL POLYGONS

mishani99

08-17-2009, 05:58 AM

Hi folks,

I have some horizontal 2D polygons with different z (elevation), different shapes and different number of vertices. I'm going to construct a 3d object from this polygons (contours), such that each 2d polygon is the boundary of 3d object at that elevation. How can I do that?

I have some horizontal 2D polygons with different z (elevation), different shapes and different number of vertices. I'm going to construct a 3d object from this polygons (contours), such that each 2d polygon is the boundary of 3d object at that elevation. How can I do that? Sounds like you don't want to change the vertex coordinates of these polygons. In that case you have to apply translations to each polygon, which would look something like -

glPushMatrix; glTranslate(x1,y1,z1); Draw_Poly1; glPopMatrix;

glPushMatrix; glTranslate(x2,y2,z2); Draw_Poly2; glPopMatrix;

glPushMatrix; glTranslate(x3,y3,z3); Draw_Poly3; glPopMatrix;

glPushMatrix; glTranslate(x4,y4,z4); Draw_Poly4; glPopMatrix;

glPushMatrix; glTranslate(x5,y5,z5); Draw_Poly5; glPopMatrix;

This approach would not reorient your polys at all. Is that sufficient to build your 3D object? This is a cumbersome way to build a 3D model.

Stuart McDonald

08-19-2009, 02:52 AM

I think what they require is a way to build triangles that would form the "vertical sides" of the 3D shape. i.e. imagine the simple case of two 2D polygons (squares). These are stacked on top of each other each at a different height (Y), but I presume parallel to each other i.e. the Y coord is the same for each vertex in each polygon.

So need a method to generate the triangles that connect the bottom polygon to the polygon above. In this simple case, if the 2 polygons were the same orientation and size it would form a box.

I think that's what they want...but I've no idea how to solve it :)

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.