/** * Examines the distance each point is from the centroid to determine the scaling difference * between world control points and the null points. */ 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. */ 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); }
/** * Converts a generalized plane equation into a {@link PlaneNormal3D_F64}. The point on the plane is the mean of the * provided points. Normal is normalized to 1. * * @param original (Input) Generalized plane equation * @param points (Input) List of points on the plane * @param output (Output) Converted normal. */ public static PlaneNormal3D_F64 convert( PlaneGeneral3D_F64 original , List<Point3D_F64> points , PlaneNormal3D_F64 output ) { if (output == null) output = new PlaneNormal3D_F64(); UtilPoint3D_F64.mean(points,output.p); ClosestPoint3D_F64.closestPoint(original,output.p,output.p); output.n.set( original.A, original.B, original.C ); output.n.normalize(); return output; }
UtilPoint3D_F64.mean(worldPts,meanWorldPts);
UtilPoint3D_F64.mean(worldPts,meanWorldPts);