On 19/02/2015 at 17:27, xxxxxxxx wrote:
if (!obj)
return;
if (obj->GetType() != Opolygon) // Otype being the object type, see docs for types
return;
PolygonObject* pobj = ToPoly(obj);
BaseSelect* bs = pobj->GetPolygonS(); // Gets currently selected polygons by index
CPolygon* polys = pobj->GetPolygonR();
Vector* points = pobj->GetPointR();
CPolygon* p = NULL;
Vector vA, vB, vC, vD;
LONG a, b;
for (LONG i = 0L; bs->GetRange(i,&a,&b); ++i)
{
for (; a<=b; ++a)
{
// For each selected polygon
// get vertices a, b, c, optionally d
p = &polys[a];
vA = points[p->a];
vB = points[p->b];
vC = points[p->c];
// if polygon is a quadrangle, not a triangle
if (p->c != p->d)
vD = points[p->d];
}
}
If you want to store all of the point vectors for the selected polygons, you should first get the number of them (LONG cnt = bs->GetCount()) and allocate a Vector array (cnt*4) size. Then fill that linearly. Note that you most likely will have duplicate vectors since polygons share points.