# Coating a sphere with bumps (golf-ball-ish) for wheel treads Classic List Threaded 10 messages Open this post in threaded view
|

## Coating a sphere with bumps (golf-ball-ish) for wheel treads

 My goal: a hemisphere coated with kinda-evenly-spaced bumps, for a robot wheel's treads.  I get that this is hard because space-filling spheres on the skin of a sphere is hard.  Is there an easy approximate way to do it that I'm missing, something like make a bunch of spheres around the equator move up in latitude a bit shrink the sphere-ring offset the start (rotation) by .5 spheres reduce the number of spheres so they still fit (might get messy at the end of each rotation) continue until you get something reasonable. I tried it with random rotations, and meh... it was ok.  The over-clustering was annoying, but that is what I get for doing it the lazy way with random rotations. num_spheres = 800; random_vect=rands(0,360,num_spheres*3,43); for(v=[0:num_spheres-1])     rotate([random_vect[v],random_vect[v*2],random_vect[v*3]])     translate([0,50,0])     sphere(5, center=true); -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Coating a sphere with bumps (golf-ball-ish) for wheel treads

 I wrote part of my Master's thesis on this problem ;).What you want to do is start with the vertices of a platonic solid mapped up to the sphere, then subdivide each face to get more spheres as needed.   The subdivision is easiest if you use a solid with triangular faces.An icosahedron would be best but if you are lazy you can use an octahedron (which is easy since the vertices are just {(-1,0,0), (1,0,0), (0,-1,0), (0,1,0), (0,0,-1), (0,0,1)}To subdivide a triangle just find the midpoint of each edge, then triangulate them to get four sub-triangles.   When you do this on a polyhedron, divide the resulting vector from the origin of the sphere to get a length-1 vector lying on the surface of the sphere.   Once you have enough vertices replace them with spheres of a suitable size and subtract them from a base sphere. It's easy to do this kind of thing recursively if you don't mind duplicate spheres, harder if you try to avoid them.  But if you are lazy just live with the duplicates; differencing will be a little slower but it *should* still work.Note that subdivisions will not result in a perfectly even distribution but that's impossible anyway.   Starting from an icosahedron will give you a more uniform distribution but try the octahedron first.On Fri, May 25, 2018 at 1:23 PM, benjaminhill wrote:My goal: a hemisphere coated with kinda-evenly-spaced bumps, for a robot wheel's treads.  I get that this is hard because space-filling spheres on the skin of a sphere is hard.  Is there an easy approximate way to do it that I'm missing, something like make a bunch of spheres around the equator move up in latitude a bit shrink the sphere-ring offset the start (rotation) by .5 spheres reduce the number of spheres so they still fit (might get messy at the end of each rotation) continue until you get something reasonable. I tried it with random rotations, and meh... it was ok.  The over-clustering was annoying, but that is what I get for doing it the lazy way with random rotations. num_spheres = 800; random_vect=rands(0,360,num_spheres*3,43); for(v=[0:num_spheres-1])     rotate([random_vect[v],random_vect[v*2],random_vect[v*3]])     translate([0,50,0])     sphere(5, center=true); -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Coating a sphere with bumps (golf-ball-ish) for wheel treads

 This post was updated on . Here some (tricky) code that demonstrates subdivision starting from a regular octahedron. Although the code is very lazy and therefore quite slow, the result is printable. It recursively loops over a dirty polyhedron() call (sorry for this, Carsten) and employes hull() to avoid all the nasty work usually connected with subdivison. s = 100; p = [[-s, 0, 0], [0, -s, 0],[s, 0, 0], [0, s, 0], [0, 0, s], [0, 0, -s]]; d = [ // octahedron      [p, p, p],      [p, p, p],      [p, p, p],      [p, p, p],      [p, p, p],      [p, p, p],      [p, p, p],      [p, p, p], ]; for(k=[0:4])   translate([k*s*2.01, 0, 0])     hull()       for(i=d)         subdivide(i, n=k);  // n<5 module subdivide(d, n=2)   if(n==0)     polyhedron(d, [[0,1,2]]);   else       for(l=div(d)) subdivide(l, n-1); function div(d) =   let(r = norm(d))   let(b = [for(i=[0:2]) half(d[i], d[(i+1)%3], r)])   [[d, b, d], [d, b, d], [d, b, d], b]; function half(a, b, r) = let (x = a+0.5*(b-a)) x/norm(x)*r; -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Coating a sphere with bumps (golf-ball-ish) for wheel treads

 In reply to this post by benjaminhill After reading the original post, I felt that geodesic spheres might be useful in this situation. The foundation for a geodesic sphere is an icosahedron, which of course, has all vertices on the surface of a sphere. A geodesic progression splits each edge and moves the split point to the sphere's surface, then joins them with additional edges. A 1v is an icosahedron, while a 2v breaks each edge into two sections. The progression is linear and complex at the higher frequency figures. I did a quick search for geodesic sphere coordinates and was surprised at the number of technical documents returned. The math is well beyond my comprehension, but I suspect one could take the formulae that generates the coordinates and use those numbers as translate parameters for the bumps. You'd get as regular a construction as space allowed, especially by allowing for parametric entry of major sphere diameter and minor sphere diameters, as well as frequency. I've assembled a paper 3v geodesic sphere and it's a work of art. Having a 3D model that allows me to place spheres at each vertex would be an interesting bit of code. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Coating a sphere with bumps (golf-ball-ish) for wheel treads

 In reply to this post by Parkinbot I wrote some (probably less-than-optimal) subdivision sphere code a while ago that constructs a list of vertices and faces and calls polyhedron to generate the sphere. It is quite similar to what others have described in this thread: ssphere(r=1.0, n=1); function norm(v) = sqrt(v*v+v*v+v*v); function normalize(v) = [v/norm(v), v/norm(v), v/norm(v)]; function flatten(vec) = [for (v=vec) for(e=v) e]; module ssphere(r=1, n=0) {         C0 = (1+sqrt(5))/4;         pts = [[0.5, 0, C0], [0.5, 0, -C0], [-0.5, 0, C0], [-0.5, 0, -C0], [C0, 0.5, 0], [C0, -0.5, 0], [-C0, 0.5, 0], [-C0, -0.5, 0], [0, C0, 0.5], [0, C0, -0.5], [0, -C0, 0.5], [0, -C0, -0.5]];         fcs = [[10, 2, 0], [5, 10, 0], [4, 5, 0], [8, 4, 0], [2, 8, 0], [11, 1, 3], [7, 11, 3], [6, 7, 3], [9, 6, 3], [1, 9, 3], [7, 6, 2], [10, 7, 2], [11, 7, 10], [5, 11, 10], [1, 11, 5], [4, 1, 5], [9, 1, 4], [8, 9, 4], [6, 9, 8], [2, 6, 8]];         npts = [for (v=pts) normalize(v)];         subdiv_sphere(npts, fcs, r, n); } module subdiv_sphere(pts, fcs, r, n) {         if (n>0) {                 spts = concat(pts, flatten([for (f=fcs) [(pts[f]+pts[f]), (pts[f]+pts[f]), (pts[f]+pts[f])]]));                 nsfcs = flatten([for (i=[0:len(fcs)-1]) [[fcs[i], len(pts)+3*i+0, len(pts)+3*i+2], [len(pts)+3*i+0, len(pts)+3*i+1, len(pts)+3*i+2], [len(pts)+3*i+0, fcs[i], len(pts)+3*i+1], [len(pts)+3*i+2, len(pts)+3*i+1, fcs[i]]]]);                 nspts = [for (v=spts) r*normalize(v)];                 subdiv_sphere(nspts, nsfcs, r, n-1);         }   else polyhedron(points=pts, faces=fcs); } You could just (ab)use the list of points to place smaller spheres to be subtracted from the main sphere in order to generate dimples. The subdivided distribution of points probably looks closer to what a real golf ball's dimple distribution looks like... MKB -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Coating a sphere with bumps (golf-ball-ish) for wheel treads

Open this post in threaded view
|

## Re: Coating a sphere with bumps (golf-ball-ish) for wheel treads

Open this post in threaded view
|

## Re: Coating a sphere with bumps (golf-ball-ish) for wheel treads

 You all are amazing.  Here is right before my print to flexible TPU for the "cap a motor tilted at 45°" wheel. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org