Hey, I’m stuck on one problem, I’ve some dummy data points and using them I’m creating sphere points and plotting them into the ground. Using the same points I’ve created a polygon also and now I’m stuck on this how can I move the points a little bit towards the centre of the polygons so that the sphere should points comes inside of the polygon, not at the corners/edges of the polygon.

Here is my playground - Playground

Please, can anyone help me regarding this. How can I calculate the center of the polygon and move the spheres towards them.

You can calculate the average of all the points on the polygon, and for each point move it along the direction between that point and the average

I think this will be a bit more complicated than averaging all the points, you will have to calculate the centroid of the polygon, which is a bit less simple (see geometry - Why doesn't a simple mean give the position of a centroid in a polygon? - Mathematics Stack Exchange for why the centroid of a polygon is not given by the average of the vertices): see geometry - How can I calculate the centroid of polygon? - Mathematics Stack Exchange for example, but there are many other references.