MATLAB: Obtaining contour point resolution between contour vertices, [conxy] = contour(…

contourequidistantMATLABprobability densityresolutionwaypoints

UPDATE: Smoothing of the contour or changing bin sizes is not what I'm looking for as solutions. The contours shown in the provided graph are ideal for the purpose of this code, i'm looking to find points between the existing contours vertices.
Use of the function [conxy] = contour(… returns the vertices of the contour line(s). I wish to obtain points along the contour between vertices so another function can distribute waypoints around the contour at equisdistant (or closely distant due to inevitable differences in lengths between points not discretising equally) points along the contour perimeter. The main issue is when certain sections of the contour have a large number of vertices, the waypoints can end up very close to one another after using linspace.
The graph provided shows the returned contour vertices as cyan markers. The larger purple markers are the current waypoints returned by, Waymark = conx(round(linspace(1,length(conx), no_wpt))). The other lines are just to find which two points have the greatest offset on a contour (unrelated to question). The parula (colormap) scattered data are x, y offsets with z defined as the heading (it's a ship). The contours are based off of a hist3 grid. I do not wish to use any contour smoothing function, only increase number of points along the existing contour.

Best Answer

I used a method to find additional points along the lines between the contours vertices (cyan markers in original graph). I found the distance between the two vertices to define the spacing of points so that the contour perimeter has close to equidistant points. This process is performed around the entire contour perimeter. This method is not smoothing of the contour line it is increasing the number of points that define that contour i.e. the contour shape won't change - no binning changes or smoothing is needed.
[conxy] = contour(centers{:}, values.', [CPD(ic) CPD(ic)], 'LineWidth', 2);
conxy(:,find(abs(conxy(1,:)) < 0.1)) = [];
plot(conxy(1,:), conxy(2,:), 'c.','MarkerSize', 20)
hold on
conxyd = []; discretmax = 0.5
for ii = 1:length(conxy)-1
vertdist = sqrt((conxy(1,ii)-conxy(1,ii+1))^2 + (conxy(2,ii)-conxy(2,ii+1))^2);
discret = floor(vertdist)/discretmax
if discret < 0.5
conxyii = []
else
conxyii =[linspace(conxy(1,ii), conxy(1,ii+1),discret); linspace(conxy(2,ii), ...
conxy(2,ii+1),discret)];
end
conxyd = [conxyd conxyii];
end
plot(conxyd(1,:), conxyd(2,:), 'm.','MarkerSize', 10)
hold on
conxy = conxyd
Contour vertices obtained from the contour function are shown as cyan markers, the magenta markers are the points between the vertices spaced at 0.5m about the perimeter.