'How to generate a random Vector3 point inside a polygon
I work on Unity3D and I have a Vector3 array, this array is the vertex of a polygon. Now I try to Generate a random point inside the polygon and I don't know how many vertex I have.
e.g:
polygonBorders = new Vector3[3];
polygonBorders[0] = new Vector3(35.3f, 1.3f, -20.1f);
polygonBorders[1] = new Vector3(35.3f, 1.3f, -3.42f);
polygonBorders[2] = new Vector3(52.11f, 1.3f, -3.42f);
this is my polygon and I want a method like that:
Vector3 GeneratePointInsidePolygon(Vector3[] polyogn, Vector3 point)
I try to find a solution all over the Internet and there is no solution or libraey
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
