THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/08/2006 at 12:49, xxxxxxxx wrote:
Either using the cache (if you will only be reading the polygon points) or the converted polygon object, you need to do these:
// Cast the object to a polygon object. This just saves time recasting. Make sure that you have a polygon object.
if (!obj->IsInstanceOf(Opolygon)) // not a polygon object
PolygonObject* pobj = ToPoly(obj);
// Get the Polygon and Vector arrays and counts.
CPolygon* polys = pobj->GetPolygon();
Vector* verts = pobj->GetPoint();
LONG pcount = pobj->GetPolygonCount();
LONG vcount = pobj->GetPointCount();
if (!(polys && verts)) // raise an error
// Traverse the polygon list and get the polygon points
CPolygon* lp = polys+pcount;
for (polys; polys != lp; polys++)
v = verts[polys->a];
v = verts[polys->b];
v = verts[polys->c];
v = verts[polys->d];
v contains the Vectors of the polygon. The Vector class contains the (X,Y,Z) coordinates of the point. For Polygons that are triangles, polys->c == polys->d.
These are the UNtransformed point coordinates. If you need the transformed coordinates, you'll need to get the object's global matrix and multiply to the points:
Matrix mg = pobj->GetMg();
v = v * mg;
v = v * mg;
If animation is involved, you'll need to AnimateDocument() or AnimateObject() and possibly GetCache() or GetDeformCache().