protected double matchScale ( List < Point3D_F64 > nullPts , FastQueue < Point3D_F64 > controlWorldPts ) { Point3D_F64 meanNull = UtilPoint3D_F64 . mean ( nullPts , numControl , null ) ; Point3D_F64 meanWorld = UtilPoint3D_F64 . mean ( controlWorldPts . toList ( ) , numControl , null ) ; // compute the ratio of distance between world and null points from the centroid double top = 0 ; double bottom = 0 ; for ( int i = 0 ; i < numControl ; i ++ ) { Point3D_F64 wi = controlWorldPts . get ( i ) ; Point3D_F64 ni = nullPts . get ( i ) ; double dwx = wi . x - meanWorld . x ; double dwy = wi . y - meanWorld . y ; double dwz = wi . z - meanWorld . z ; double dnx = ni . x - meanNull . x ; double dny = ni . y - meanNull . y ; double dnz = ni . z - meanNull . z ; double n2 = dnx * dnx + dny * dny + dnz * dnz ; double w2 = dwx * dwx + dwy * dwy + dwz * dwz ; top += w2 ; bottom += n2 ; } // compute beta return Math . sqrt ( top / bottom ) ; }
Examines the distance each point is from the centroid to determine the scaling difference between world control points and the null points .