I'm facing issues when trying to create voronoi regions in MATLAB and handle infinite vertices. I am relatively inexperienced in programming which I feel is hampering my ability to solve this problem.
I want to trace specific locations near the central nodes of the voronoi sub-polygons using the function inpolygon
. I can not utilise the function if one of the vertices is Infinite (INF). Therefore, I wanted to create a grid around the voronoi split (As seen in image), and only consider the region within this grid, thereby neglecting the infinite vertices.
What I have done so far:
I already have a certain 100 pairs of Latitudes and Longitudes of nodes, around which I create a voronoi split using voronoi(x_coordinates, y_coordinates)
function.
When I have to determine the various coordinates of the sub-polygons within this split, I use the
[V,C] = voronoin([x_coordinates, y_coordinates]);
Till now, this gives me all the of voronoi regions in V
and all indexes of vertices for all sub-polygons (voronoi regions) in C
.
Then I have implemented a function which uses inpolygon and takes x and y coordinates of the point that has to be traced within one of the voronoi regions. And here is where I am stuck. I am trying to implement a grid all around, but can not find the new intersecting vertices of the grid and the voronoi sub-region to find the new vertices of the voronoi sub-polygons.
Also, if there is any other way to achieve the same task, any help would be highly appreciated.
Many Thanks.