I have a very irregular shape in the form of vectors for x and y coordinates that I want to scale down. But I want the scaled-down shape to stay within the boundaries of the original shape. I thought just doing x_scaled = s * x
and y_scaled = s * y
would do the trick but this is what I get when I do that :-
As you can see the scaled-down shape crosses the boundaries of the original at multiple points. I would like for it to be completely contained inside the original shape. What I want would be something similar to this (not accurate, just a representation I tried making in photopea) -
The representation I made is not very good but I hope it helps get my point across. I just want the scaled-down shapeto be fully inside. And I am not sure how to do that. The language I am using is MATLAB but if I can just understand the logic I should be able to implement it.