Geodesic Polyhedra

Geodesic Polyhedron

Within Babylon.js a geodesic polyhedron (GDP) is formed for an icosahedron base and its vertices mapped onto a sphere. An icosahedron made 20 faces each a primary equilateral triangles. To form a GDP each face is split into further equilateral triangles forming an isometric grid. Before creating the GDP this grid can be rotated by an angle determined by the values of two parameters m and n both integers. When n is 0 no rotation of the grid takes place and the resulting GDP is an icosphere.

On this page we explain how to create a GDP directly. More information about GDP Mathematics and an outline of coding a GDP are available in the documentation workshop.

The format for creating a GDP very much matches that of CreatePolyhedron. A GDP can only be created with MeshBuilder.

MeshBuilder

usage :

const geodesic = BABYLON.MeshBuilder.CreateGeodesic("geodesic", options, scene); //scene is optional and defaults to the current scene
optionvaluedefault value
option
m
value
(number) an integer > 0
default value
1
option
n
value
(number) a positive or zero integer <= m
default value
0
option
size
value
(number) polyhedron size
default value
1
option
sizeX
value
(number) X polyhedron size, overwrites the size property
default value
1
option
sizeY
value
(number) Y polyhedron size, overwrites the size property
default value
1
option
sizeZ
value
(number) Z polyhedron size, overwrites the size property
default value
1
option
faceColors
value
(Color4[]) array of Color4, one per face
default value
Color4(1, 1, 1, 1) for each side
option
faceUV
value
(Vector4[]) array of Vector4, one per face
default value
UVs(0, 0, 1, 1) for each side
option
flat
value
(boolean) if false, a polyhedron has a single global face, faceUV and faceColors are ignored
default value
true
option
updatable
value
(boolean) true if the mesh is updatable
default value
false
option
sideOrientation
value
(number) side orientation
default value
DEFAULTSIDE

To understand how to set faceUV or faceColors, please read about Face Colors and Textures for a Box taking into account the right number of faces of your polyhedron.

Examples

PG: Geodesic Polyhedron

Further reading