function postprocessing_contact_pattern_GF(CMDATA, PPDATA, IDDATA) %{ Function for defining the contact pattern on the glenoid. -------------------------------------------------------------------------- Syntax : postprocessing_contact_pattern_GF(CMDATA, PPDATA, IDDATA) -------------------------------------------------------------------------- Function Description : This function defines the migration of the contact area on the glenoid fossa. The surface area shown here is the same as the surface area on the humeral head. -------------------------------------------------------------------------- %} % define the width of the mesh % ------------------------------------------------------------------------ HHT_MIG = figure; title('contact pattern on the glenoid fossa',... 'fontsize', 11, ... 'fontweight', 'bold', ... 'fontname', 'sansserif'); axis off; for TimeStep = 1:size(IDDATA.t,2)-1 % to rotate the arm the rotation matrix is considered % at each time step for the whole time % horizon u = [IDDATA.Coordinate_Evolution(:,TimeStep); IDDATA.Coordinate_Evolution_D(:,TimeStep)]; % the generalized coordinate and velocity vector Rot_G2T = versatile_function('define Rot_G2T',u); % define the rotation matrix counter = 1; % count the number of points penetrating in the cartilage for i = 1:size(PPDATA.h_inT{1,TimeStep},1) for j = 1:size(PPDATA.h_inT{1,TimeStep},2) if isequal(PPDATA.h_inT{1,TimeStep}{i,j},0) % this is not what we are looking for; elseif isequal(PPDATA.h_inT{1,TimeStep}{i,j},[]) % this is not what we are looking for; else gf_contact(:,counter) = [eye(2,3)*Rot_G2T'*PPDATA.h_inT{1,TimeStep}{i,j} ; PPDATA.deformation{1,TimeStep}(i,j)]; % a vector containing the position of the point in the % glenoid frame. The last element is the deformation % associated with this point. counter = counter + 1; end end end % if counter > 2 % to automatically define the dimensions of the % rectangles. % mesh_size = 1e3*norm(gf_contact(1:2,1) - gf_contact(1:2,2)); % % mesh_size = 2.6; % %break % else mesh_size = 2.6; % end % %end % ------------------------------------------------------------------------ % plot the migration of the contact area on the glenoid fossa % ------------------------------------------------------------------------ % plot the background picture of the glenoid HHT_MIGAxis = axes('units', 'normalized', 'position', [0.04, 0.1, 0.8, 0.8]); % left distance, bottom distance, width, height CurrentDirectory = pwd; fossa = imread([CurrentDirectory, '/input figures/fossa_try4.png'], 'png'); set(HHT_MIG, 'CurrentAxes', HHT_MIGAxis); image(fossa); box off; axis off; axis equal hold on % plot the rectangles axes('units', 'normalized', 'position', [0.1, 0.12, 0.8, 0.8]); % viscircles([0 0],30,'LineStyle','-','Color','k') if counter > 1 % if there is a point that pentrates for i = 1:counter-1 rect = rectangle('Position',[1e3*gf_contact(1,i)-(mesh_size/2) 1e3*gf_contact(2,i)-(mesh_size/2) mesh_size mesh_size]); rect.FaceColor = postprocessing_color_map(1e3*gf_contact(3,i),1e3*max(PPDATA.max_deformation)); rect.EdgeColor = [0.6 0.6 0.6]; % plot a rectangle for every point for which the penetration % occurs end end % plot the colorbar cmap = jet(50); colormap(cmap); caxis([0 1e3*PPDATA.max_deformation(TimeStep)]); h1 = colorbar; set(h1,'fontsize',16); % set the font of the colorbar ylabel(h1, 'cartilage deformation [mm]'); % plot a circle to scale everything correctly (what I think) viscircles([0 0],30,'LineStyle','none'); box off;axis off; axis equal % show extra information about the contact, including abduction angle, % contact area, maximum deformation. str1 = ['abduction angle = ',num2str(-(180/pi)*IDDATA.ImposedMotion(4,TimeStep)), ' [deg]']; % show the abduction angle on the plot str1_prop = annotation('textbox',[0.00 0.00 0.5 0.05],'String',str1,'FitBoxToText','off','BackgroundColor','w'); str1_prop.FontSize = 16; str2 = ['contact area = ',num2str(PPDATA.cont_area(TimeStep)), ' [mm\^{2}]']; % show the contact area on the plot str2_prop = annotation('textbox',[0.00 0.05 0.5 0.05],'String',str2,'FitBoxToText','off','BackgroundColor','w'); str2_prop.FontSize = 16; str3 = ['max. deformation = ',num2str(1e3*PPDATA.max_deformation(TimeStep)), ' [mm]']; % show the contact area on the plot str3_prop = annotation('textbox',[0.50 0.00 0.5 0.05],'String',str3,'FitBoxToText','off','BackgroundColor','w'); str3_prop.FontSize = 16; % animation generator pause(0.5) % keep the current figure for pause(.) seconds if TimeStep < size(IDDATA.t,2)-1 % if it's the last figure, keep it cla delete(h1) % delete the colorbar end end return;