Archived

This topic is now archived and is closed to further replies.

Leyder Dylan

Structure Problem

Recommended Posts

Hi, I''ve this structure : VECTOR 3D vPolygone[4]; My problem is that with this structure, I''ve only one polygone. I would like to make another structure for calling more that one polygone. Ex : Polygone[0].vPolygone[4]; // Polygone 1 Polygone[1].vPolygone[4]; // Polygone 2 Polygone[2].vPolygone[4]; // Polygone 3 etc ... Thanks in advance. ======================== Leyder Dylan http://ibelgique.ifrance.com/Slug-Production/

Share this post


Link to post
Share on other sites
A very simple and quick solution would be to use a structure (or class) of "polygon's".

For example just create a structure like this in C++:


struct POLYGON
{
VECTOR3D vertex[4];
};


Then create an array of POLYGON's:


POLYGON polygons[NUM_POLYGONS];


then you can access the polygon's in the way you specified in your post:


polygons[0].vertex[0].x = 15; // for example


You should use a class if you also need associated methods.
I hope that helps.


Edited by - drown on October 16, 2001 1:37:10 PM

Share this post


Link to post
Share on other sites