classdef Sphere < handle % Simple sphere object. % Used to be fitted to glenoid points. % % This class could be used elsewhere and the constructor % access might be widen. properties center radius residuals R2 RMSE end methods function obj = Sphere() obj.center = []; obj.radius = []; obj.residuals = []; obj.R2 = []; obj.RMSE = []; end function fitTo(obj,points) [center,radius,residuals,R2] = fitSphere(points); obj.center = center'; obj.radius = radius; obj.residuals = residuals; obj.R2 = R2; obj.RMSE = norm(residuals)/sqrt(length(residuals)); end function output = isempty(obj) output = any(cellfun(@(field)isempty(obj.(field)),fields(obj))); end end end