# Closing "Fibonacci's Hole"

Creating a sphere using the points defined by Spherical Fibonacci Mapping. For the most part it is easy to "skin" by using two consecutive fibonacci numbers as steps to loop on the index. And get results similar to Here is what I have so far Edges made by stepping thru verts with 8th Fibonacci number 21 and 9th; 34.

The hassle comes around the poles, so I stopped short leaving a leaflike pattern hole.

The select verts in the image are those that have 3 faces and 4 edges.

verts = [ v for v in bm.verts


For each of these verts there is a rip. (the two edges with only one face)

split_edges = [q for e in v.linked_edges
for q in e.verts
# sort by length
split_edges.sort(key=lambda a:-a.calc_length())


The desired result will close that split at the selected vert leaving a "T" 3 edge vert with the caveat of leaving the vertex in place. (As it is a member of SF space).

I was hoping to be able to swap the verts from one BMedge to another, but alas...

What other methods are available other than removing two edges adding one and a face?

The spherical fibonacci code can be found here https://gist.github.com/batFINGER/64db074e95b716f839a71882b7efcc50

The sample mesh in q can be generated using:

scene = context.scene
n = 1024
# create a point mesh
sfmesh = SFBMesh(n)
#sfmesh.edge()
# make mesh using 9th and 10th fibonacci numbers
k = 9
bm = sfmesh.bm
bm.verts.ensure_lookup_table()
for i in [k, k + 1]:
fib = F(i)
print("Fib number ", i, fib)
start = fib - F(i-2)
start = 2
edges = [bm.edges.new([bm.verts[i] for i in [k, (k + fib) % n]]) for k in range(start, n - fib - 2)]
#bmesh.ops.convex_hull(bm, input=verts)
bmesh.ops.contextual_create(bm, geom=bm.edges)
faces = [f for f in bm.faces if len(f.verts) > 4]
bmesh.ops.delete(bm, geom=faces, context=5)
meshdata = sfmesh.mesh
goldie = bpy.data.objects.new("SF", meshdata)
scene.objects.active = goldie
goldie.select = True

• If you wanted to do it manually, how does it look like ? Aug 16 '16 at 15:41
• Something like d or e in i.stack.imgur.com/Og9J5.png Aug 16 '16 at 16:26
• Calling sfmesh.edge() gives a result something close-ish to (f). Aug 16 '16 at 17:12
• There is an addon called sverchok which can generate mathematically based meshes you can give it a try i guess.
– xlxs
Sep 14 '16 at 0:15
• this question seem too technical and would take a lot of time to get into for most users. If you add some explanations, more users will be able to help. Which "hassle" came round the pole? You say you "stopped short", what do you mean by that? How did you come up with the expression to create edges? Because vertices seem to be perfectly fine. Sep 20 '16 at 14:06

Oh gosh, I spent ages with it. On the pictures you posted it looks particularly nice because of lines are actually spirals. If they were straight it won't look nice. On your picture pole doesn't have quads and also has a lot of adjacent edges. So if you don't want this, maybe you can just stop (I would stop earlier) and connect the rest of the points using a different triangulation method?

In your implementation there is same distance of fib between each pair of vertices you connect. So the question comes when index + fib is larger than number of vertices. Where do you want to connect the rest of them?

This is what I get for k = 7. And this for k = 9. This is the bit I changed. But I am no expert in either bmesh nor bpython, so maybe you can polish it.

# make mesh using 9th and 10th fibonacci numbers
fibk = 7
bm = sfmesh.bm
bm.verts.ensure_lookup_table()
for i in [fibk, fibk + 1]:
fib = F(i)
print("Fib number ", i, fib)
for k in range(-fib+1, n-1 ):
for i in [k, min(n-1,k + fib)]:
try:
bm.edges.new([bm.verts[max(0,k)],bm.verts[min(n-1,k + fib)]] )

except(ValueError):
print('duplicate')


1) Also you can find code here which produces this, maybe it will be useful. 2) Also look at this post which leads to this solution: It seems there are in general not many ways to make a nice quad mesh of a sphere.No matter how you do it, there always is going to be a seem. I think 1) and 2) two are basically the main solutions.

Bo, if you want Fibonacci I would go with 2),so cut it off and close it as they did, if you want regular - with 1).

• Yep spent too much time on it too.. here's where I got to. gist.github.com/batFINGER/… On doing it with a numbers approach on the index got a hunch that when you get near poles (index < 21 for fib(8) and zero pole) need to step down in fib numbers that sum to that index. Sep 20 '16 at 17:22
• @batFINGER essentially you want a Delaunay triangulation and a smart way of merging pairs of triangles for the case of this Fibonacci whatever mesh. So for the middle it seems smart enough to merge them like it is now, but there is a point where this Fibonacci step is not giving you nearest neighbour any more (which Delaunay does) Sep 20 '16 at 17:33
• @batFINGER wait, can't you just stop before this starts happening and sort of rotate your sphere 90 degrees, so that the poles are at the equator? And use the same sort of meshing as now, which looks good at the equator. Sep 20 '16 at 17:49
• @batFINGER in fact, this image looks like diving it in 3 bits of 120 degrees and having a seem in between. Sep 20 '16 at 18:24