# How to calculate the vertices of an icosphere

How can I calculate the vertices of an icosphere and identify them with x,y coordinates? I want to generate an icosphere grid of vertices.

**Answer** by Bunny83
·
Nov 01, 2015 at 11:26 AM

Start by creating a Icosahedron which is actually the "smallest" icosphere.

Then you can use a simple subdivide method like the ones i've posted over here(don't miss the link to the wiki at the end).

Once subdivided you simply "normalize" all vertices so they have the same distance from the center. If the Icosahedron has been created around the local origin you can simply do

```
v = v.normalized * radius;
```

for each vertex.

You can repeat the subdiv process several times if you want to get the desired resolution.

I'm just a bit confused since you said "x, y" instead of "x,y,z" and used the term "grid". Those terms usually refer to 2d while a sphere is a 3d object. Maybe i didn't get what you actually want. If that's not what you want, feel free to edit your question and include more details, maybe a drawing or screenshot of what you want.

Just realised that the wiki link was still an old link ^^. Fixed the link.

I actually need to map the icospheres sides into a 2d array, but I might have to give each side of the sphere a int to identify it by. This picture kinda describes the problem with this: Let's say that on the left side is "Side 1" and the right one is "Side 2" I then need to function for point 1,1 to find 0,3 as it's neighbour.

I can only come up with one solution for this and it is to check after the 8 closest points to the neighbour sorted by distance, but this would take a lot of time because it would have to scan all the vertices every time it had to get the neighbour of one node, but I could scan the sphere once and then make each node have a list of the pre-computed neighbours. This would kinda fix the problem, but do anyone have a better solution for this?

Sorry, but i have no idea what you actually want. An icosphere doesn't really have a "side". You talk about a two dimensional array, but what relation does your array have with the icosphere? An icosphere consists of triangles, not quads, so how do you put them into a 2d array?

Your question just asked how to generate the vertices of an icosphere. I'm not sure what you mean by "identify them with x,y coordinates". Do you mean to use polar coordinates on the sphere? Are you sure you talk about an icosphere? Since you talk about neighbors, neighbors of what? If you mean adjacent vertices of a vertex? A vertex of an icosphere has either 5 or 6 adjacent vertices. If you talk about triangles, each triangle has exactly 3 neighbors. I don't see where your "2d grid" fits into this.

Feel free to **edit** your **question** and add more details. At the moment it's not really clear what you want to do.

I am sorry, I have totally misunderstood the term icosphere. My misunderstanding is caused by me googling around trying to find a solution which gave me a sphere which I though was an icosphere because it continously appeared with the context icosphere. I though this was an icosphere: This sphere clearly has sides which can be used in a 2D array, but I have now tried to implement a 3d array instead, because the way to use this seems to be way easier with a 3 dimensional array.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

How to import .dae file runtime with more than 65k vertices 0 Answers

Instantiate GameObjects in a Sphere shape 2 Answers

delete vertex on spheres 0 Answers

assigning several positions and call array of raycasts 0 Answers

Access to grid points on a sphere? 0 Answers