- Start by outlining your irregular shape with a series of points.
- Use “meshgrid” to cover the area within the bounding box of your shape, providing a comprehensive grid of x and y coordinates.
- Apply a logical mask to exclude points outside the irregular shape. The “inpolygon” function can help identify which grid points lie within the shape.
- With the mask applied, extract the x-coordinates of points that fall inside the shape.
- meshgrid: https://www.mathworks.com/help/matlab/ref/meshgrid.html
- inpolygon: https://www.mathworks.com/help/matlab/ref/inpolygon.html