Golberg Icosahedral

seems ok! gj ! thanks a lot !

I’ve checked with the GP faces formulae and it matches:
a GP(m,n) has 10T+2 tiles with T = mm + mn + nn (I use tile instead of face to avoid confusion because face in 3D engine is usually a triangle).
so a GP(m,m) has : T = 3
m*m , tiles = 10T+2 (12 pentagons and 10(T-1) hexagons).

If we take m=7, GP(7,7) has 1472 tiles (12 pentas + 1460 hexas).
With 3 triangles used to render a penta and 4 triangles for an hexa this gives a total of 5876 triangles which matches the value in BJS inspector.

A cool addition would be to store for each triangle the tile index it is part of so that we have an easy and fast way to get this index when clicking on a triangle.

This may help Facet Data | Babylon.js Documentation

1 Like

Looks good! congratz! im going to test it out. LOVE IT!

The model is correct, but it has rendering issues when you change the radius.

Please provide PG to show the issue. Is your camera far enough away to be outside the polyhedron? When still inside you will need to set the sideOrientation.

The problem is when setting a radius above 1.17: for instance radius 20, cam at 50: https://www.babylonjs-playground.com/#S753J0#14
Seems there is a problem with projecting to a sphere & scaling at the same time.

I moved the scaling to given radius outside the generation code using CreatePolyhedron “size” parameter: https://www.babylonjs-playground.com/#S753J0#22
no more distortion.

@Juvenius_Drakonius thank you for highlighting the problem and @KGersen thank you for the PG and the solution. This correction applies to Class I as well https://www.babylonjs-playground.com/#S753J0#42

For https://www.babylonjs-playground.com/#S753J0#42
It still has a very visible distortion lines on m > 50

in line 219:

const GD = createGDM0(55); //param

I agree. You can actually see the error in the geodesic with m = 20 https://www.babylonjs-playground.com/#S753J0#44. I think the error occurs with lower m numbers it is just harder to see.

If you take out the part that makes the polyhedra spherical even with m = 5 the triangulation into smaller triangles looks OK https://www.babylonjs-playground.com/#S753J0#45 so something in mapping to a sphere is producing inaccuracies.

EDIT The code that made the polyhedra spherical was in the wrong place. It was run for every face corrected accumulating errors as it went. Now only run once :crossed_fingers: I now have it correct for

Class I https://www.babylonjs-playground.com/#S753J0#53

Class II https://www.babylonjs-playground.com/#S753J0#51

Please keep checking :slightly_smiling_face:

let me get my magnifying glass…i don’t trust my digital zoom :rofl: …Did a m = 300check, looks good with no distortion!

1 Like

I think there’s a problem adapting this approach for GP(m,n) class III, you can not rotate the plane plane where the hex are generated ( m and n) and get the precise location, since you are generating them from the centroid of the inicial truncated icosahedron face centroid, not the vertex.

I think a good approach is to generate the edge hexes first,
1 vertex(where the pentagons are)>> centroid of (m,n) >>1 vertex(where the pentagons are)

@KGersen , @Juvenius_Drakonius just to let you know I am still working on GD(m, n) class III. I am making progress albeit slowly.

1 Like

unrelated note: I noticed that enableEdgesRendering (Mesh) doesn’t use the “faces” we pass to MeshBuilder.CreatePolyhedron. This is probably by design but it would be nice to have a specialized version of enableEdgesRendering for meshes created with CreatePolyhedron.

even if enableEdgesRendering can use an epsilon, it rapidly fails because past 0.9999 we see the triangles and 0.999 works only up to m=14ish

check this PG, use the top right slider to change ‘m’ and line 301 to change the epsilon:
https://www.babylonjs-playground.com/#S753J0#72

It would be amazing if the sequence of generation of the hexes could be tweaked, so you could address the tiles to make the planet have features and such…heat maps…location…kind of like this project https://experiments.withgoogle.com/chrome/globe .

The cool thing about a hex is that it has some area, points are just too limited. I know its a bit of a stretch…but it would be so amazing to have an addressable hexasphere…with a binary file as database you can achieve very easily a lot of data with a small footprint…but the address needs to be there…

Work in progress/.

@KGersen and @Juvenius_Drakonius still working on it and am on the final straight with a couple of fences still to clear. Would like to say it would be finished in two weeks but that might be optimistic. It will probably turn out that the final fences might be trickier than I think.

As for addressable faces that could well be possible but making the addresses sensible to the shape more difficult.

yeah i guess that would make it very specific, to have it addressable. Thank you for all the effort any bit counts you are amazing at this :slight_smile:

@KGersen and @Juvenius_Drakonius bit of a setback. Found out I hadn’t jumped a fence so much as crashed through it. Had to go back re-build the fence and jump over it properly.

Back onto the final furlong again still a couple of jumps ahead.

Definitely was interested, just took a bit of time to get started and having dealt with Class I and Class II took some time to get to grips with Class III

@Juvenius_Drakonius @KGersen have now hopefully completed Class III and using A unified approach hope I have now got one method for creating all three classes - just enter m and n on lines 53 and 54 just make sure m ≥ n

https://www.babylonjs-playground.com/#GLLBLZ#26

The red peaks are the underlying icosahedron. Went for a get it to work approach rather than code efficiency. Any testing would be welcome.

I am submitting a PR to the workshop section of the docs to explain all the parts. One the next week or so I will develop a slightly more user friendly version with a GUI to choose m, n and whether to display a Geodesic or Goldberg polyhedra and add a user page for the docs.

Will also look at working on facet numbering and facet coloring.

If anyone thinks it is worth making it part of Babylon.js I will work on a Typescript version and eventually do a PR

1 Like

nice work! thank you very much.

so 7,0 should work but not 0,7 ?
m,0 doesn’t seem to work.

is your code like as decribed in wikipedia ?:

first take m steps in one direction, then turn 60° to the left and take n steps