I want to input the coordinates of 4 vertices of a polygon, specify the number of points to divide the polygon's edges (in equal segments), and the goal is to generate a matrix with the coordinates of the grid points inside the polygon.
The following picture might explain better my goal:
So in that case I would input the coordinates of the points (P) and specify that I want grid to be 3 by 2. The output would be a 3 by 2 matrix with the coordinates (x,y) of the grid points (N).
I have searched a lot but still couldn't find a way to do this, and honestly I am not at all experienced with Python. I found something using numpy's meshgrid in combination with matplotlib.path's contains_points to create a grid inside a polygon but I have no idea how to get the grid point's coordinates. I saw shapely being used a lot in problems like this but again, I'm not experience in this so some help would be appreciated!
Thank you all in advance!