MATLAB: Spacing points on a 2D plot evenly

interparcplotting

Hi
Im plotting a 2D closed boundary but the points going around a curve of the boundary are spaced closely to each other. The points on a straight section are spaced further away from each other. The boundary is smooth.
Is there any way to make the distance between each point the same, without changing the structure of the shape?

Best Answer

Calculate the distance between adjacent points. Create a cumulative sum of that. Divide the total distance up into as many equal segments as you desire. Use the cumulative sum to locate the adjacent points that each of the equal-length segments would fall between. The difference between the required distance and the point before, divided by the length of the segment, gives you a proportion. The proportion times the delta x and the delta y between the point and the next point gives you the delta x and delta y relative to the first point at which to place your equal-distance point.
Related Question