2018-06-04 02:17 PM - last edited on 2022-12-06 01:33 PM by Daniel Kassai
static GSErrCode ChamferPolygonWithRadius(Geometry::Polygon2DData& polygon2DData, vector<double> dRadius) { GSErrCode err = NoError; ////1.ChamferPolygon2DDataContour test //GS::VAArray<Geometry::Polygon2DData> chamPolys; //err = ChamferPolygon2DDataContour(polygon2DData, 1, 1.5, &chamPolys); //WriteReport_Alert("count is%d", chamPolys.GetItemCount()); //WriteReport_Alert("err=%d", err); //if (err == NoError && chamPolys.GetItemCount() == 1) // Geometry::CopyPolygon2DData(&polygon2DData, chamPolys[1]); //for (UIndex iResPoly = 1; iResPoly <= chamPolys.GetItemCount(); iResPoly++) // Geometry::FreePolygon2DData(&chamPolys[iResPoly]); //2.ChamferPolygon2DDataVertex test Int32 minIndex = std::min(Int32(dRadius.size()), Int32(polygon2DData.nVertices)); WriteReport_Alert("maxindex%d", minIndex); Int32 nvIndex = 0; for (Int32 i = 0; i < minIndex; i++) { if (IS_ZERO(dRadius)) continue; GS::VAArray<Geometry::Polygon2DData> chamPolys; err = ChamferPolygon2DDataVertex(polygon2DData, i+1, dRadius, &chamPolys); WriteReport_Alert("count is%d", chamPolys.GetItemCount()); WriteReport_Alert("err=%d", err); if (err == NoError && chamPolys.GetItemCount() == 1) Geometry::CopyPolygon2DData(&polygon2DData, chamPolys[1]); for (UIndex iResPoly = 1; iResPoly <= chamPolys.GetItemCount(); iResPoly++) Geometry::FreePolygon2DData(&chamPolys[iResPoly]); } return err; }
2018-06-05 09:05 AM