#### Archived

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

# Structure Problem

## Recommended Posts

Leyder Dylan    122
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 on other sites
drown    122
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