I want to let the user draw a complicated, 2D polyline, select it, and have it convert to a region so I can use the mass properties for a handful of tasks. I've gotten to the point (following the samples) where I am able to create the region using
es = AcDbRegion::createFromCurves(curveSegs, regions);
AcDbRegion *pRegion;
pRegion =static_cast<AcDbRegion*>(regions[0]); // I only have one element to pick
pRegion->getPlane(plane);
plane.getCoordSystem(origin, xAxis, yAxis);
es = pRegion->getAreaProp(origin, xAxis, yAxis, perimeter, area, centroid, momInertia,
prodInertia, prinMoments, prinAxes, radiiGyration, extentsLow, extentsHigh);
Then I save it to the database. It works fine up to this point, but I get the wrong centroid (and different than the command line "MASSPROP")
Anything obvious? Any help would be appreciated.
Thanks,
Ed