25
$\begingroup$

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
enter image description here Here is what I have so far enter image description here 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 
          if len(v.link_faces) == 3 
          and len(v.link_edges) == 4]

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
               if len(q.linked_edges) == 2]
# 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.link(goldie)
scene.objects.active = goldie
goldie.select = True
$\endgroup$
  • 2
    $\begingroup$ If you wanted to do it manually, how does it look like ? $\endgroup$ – lemon Aug 16 '16 at 15:41
  • $\begingroup$ Something like d or e in i.stack.imgur.com/Og9J5.png $\endgroup$ – batFINGER Aug 16 '16 at 16:26
  • $\begingroup$ Calling sfmesh.edge() gives a result something close-ish to (f). $\endgroup$ – batFINGER Aug 16 '16 at 17:12
  • 2
    $\begingroup$ There is an addon called sverchok which can generate mathematically based meshes you can give it a try i guess. $\endgroup$ – xlxs Sep 14 '16 at 0:15
  • $\begingroup$ 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. $\endgroup$ – Noidea Sep 20 '16 at 14:06
12
+100
$\begingroup$

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. enter image description here

And this for k = 9.

enter image description here

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. enter image description here

2) Also look at this post which leads to this solution: enter image description here

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).

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – batFINGER Sep 20 '16 at 17:22
  • $\begingroup$ @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) $\endgroup$ – Noidea Sep 20 '16 at 17:33
  • $\begingroup$ @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. $\endgroup$ – Noidea Sep 20 '16 at 17:49
  • $\begingroup$ @batFINGER in fact, this image looks like diving it in 3 bits of 120 degrees and having a seem in between. $\endgroup$ – Noidea Sep 20 '16 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.