Hi,
windows7, vs 2005,
I have been trying API function GetFitCylinder but it return strange results. I have example with scann of 3 inch pipe 18646points (theoretical radius 44.45mm)
Using API GetFitCylinder I get result Radius= 54.5mm. ( BLUE cylinder in the picture below)
Using another software( RED cylinder in the picture below)) I get this results:
Normal estimation is done with 10 neighboars
----------------------
********** Normal Estimation started.... :
-input kSearch : 10
-output plane coefficients0.00457876-0.186737-0.982399-346.195********** Normal Estimation finished.... :
-input model Sylinderthreshold = 10
-output coeficients : 1087.051636-output coeficients : -7542.705078-output coeficients : 1089.206909-output coeficients : -0.999795-output coeficients : 0.018364-output coeficients : -0.008512-output coeficients : 43.992542 ->RADIUS-output nr. points within threshold : 18646
It is obvious tha getFitCylinder result is wrong.
API code:
Bentley::Ustn::PointCloud::PointCloudDataQueryPtr sel_query = Bentley::Ustn::PointCloud::IPointCloudDataQuery::CreateSelectedPointsQuery (eeh); sel_query->SetDensity(Bentley::Ustn::PointCloud::IPointCloudDataQuery::QUERY_DENSITY_FULL,(float)1);
double UM = 0; // UORs in Master mdlCnv_masterToUOR (&UM, 1, MASTERFILE); double rad;
double rms_=sel_query->GetFitCylinder (axis, basePoint,rad,height, constrainToAxis,constrainToRadius); rms=rms_; UM=0; mdlCnv_UORToMaster (&UM, 1, MASTERFILE); //axis.x =UM* axis.x; //axis.y =UM* axis.y; //axis.z =UM* axis.z; basePoint=apiDefault::convertPoint_UOR_ToMaster(basePoint); radius =UM* rad; height =UM* height; mdlElmdscr_freeAll (&pElm);
Am I doing something wrong or GetFitCylinder computes bad result?
POD file is attached.
Thanks
Manko