discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

spacing dots along a path

AM
Adrian Mariano
Tue, Feb 28, 2023 9:15 PM

BOSL2 implements this using the "Golden Spiral Method".  You could use
that...or read the code.

https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-sphere_copies

On Tue, Feb 28, 2023 at 2:30 PM Jordan Brown openscad@jordan.maileater.net
wrote:

I would think in terms of defining a function that describes the spiral -
probably based on an Archimedean spiral
https://en.wikipedia.org/wiki/Archimedean_spiral - and then dividing
that path into N equal segments and placing a dot at each of those points.

To my eye, Archimedean spirals start to degenerate during the center loop,
violating the constant-distance-between-loops behavior that you see in the
rest of the spiral.  I would cope with that by either skipping that loop,
or by placing the dots there "by hand".

I think that what's going on in the center is that you're normally looking
at the distance from one loop to the next, 360° further along the spiral,
but in that innermost loop there is no loop further in, and you're
looking at the distance from one point to another point that is closer than
360° away.  Looking at the Wikipedia page, the most extreme case looks like
measuring from the center point to the first time the spiral crosses the +Y
axis.  That's only a quarter of a loop-to-loop distance, which looks really
small... and that's that because it's only 90° away, not 360°.

Now, I say that like I know how to do those things.  I don't.  I don't
know what an Archimedean spiral mapped onto a sphere really looks like.  I
suspect that it is phi = a + b*theta, but I'd have to plot that out to be
sure.  I have no idea how to measure the length of that path and no idea
how to find a particular point given a distance along the path.  (Well,
other than iteratively, but that's just wrong.)


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

BOSL2 implements this using the "Golden Spiral Method". You could use that...or read the code. https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-sphere_copies On Tue, Feb 28, 2023 at 2:30 PM Jordan Brown <openscad@jordan.maileater.net> wrote: > I would think in terms of defining a function that describes the spiral - > probably based on an Archimedean spiral > <https://en.wikipedia.org/wiki/Archimedean_spiral> - and then dividing > that path into N equal segments and placing a dot at each of those points. > > To my eye, Archimedean spirals start to degenerate during the center loop, > violating the constant-distance-between-loops behavior that you see in the > rest of the spiral. I would cope with that by either skipping that loop, > or by placing the dots there "by hand". > > I think that what's going on in the center is that you're normally looking > at the distance from one loop to the next, 360° further along the spiral, > but in that innermost loop there *is* no loop further in, and you're > looking at the distance from one point to another point that is closer than > 360° away. Looking at the Wikipedia page, the most extreme case looks like > measuring from the center point to the first time the spiral crosses the +Y > axis. That's only a quarter of a loop-to-loop distance, which looks really > small... and that's that because it's only 90° away, not 360°. > > Now, I say that like I know how to do those things. I don't. I don't > know what an Archimedean spiral mapped onto a sphere really looks like. I > suspect that it is phi = a + b*theta, but I'd have to plot that out to be > sure. I have no idea how to measure the length of that path and no idea > how to find a particular point given a distance along the path. (Well, > other than iteratively, but that's just wrong.) > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RD
Revar Desmera
Tue, Feb 28, 2023 9:55 PM

If you already have the path, then you can use BOSL2’s path_copies() to get an equidistant spread of items along that path.

7f60f080-3992-11eb-9baf-22e99510b07f.pngdistributors.scad

github.com

-Revar

On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com> wrote:

I wrote some code to create a spiral of spheres around the surface of a larger sphere. It works fine, but the spacing is too tight near the poles.

If I were writing in a "normal" language, I would calculate the position of each possible new sphere, then calculate the distance from that sphere to the most recently successfully placed sphere, and avoid placing the new one if the distance was too small. But I am writing in OpenSCAD, so that approach will not work; at least, I don't know how to do this in OpenSCAD.

Any thoughts?

function x(r, theta, rho) = r * sin(theta) * cos(rho);
function y(r, theta, rho) = r * sin(theta) * sin(rho);
function z(r, theta, rho) = r * cos(theta);

sphereD = 5;
numRots = 7;
numSpheres = numRots * 360;
r = 100;
for (rho = [0:5:numSpheres])
let (theta = (180 * (rho / numSpheres)))
translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)])
sphere(d = sphereD);
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

J
jon
Tue, Feb 28, 2023 10:35 PM

Thank you, Revar!

When I do this

include <BOSL2/std.scad>
include <BOSL2/distributors.scad>

then I get the error

WARNING: Ignoring unknown module 'path_copies' in file xxx.scad, line 43

which is

path_copies(path, n = 100) sphere(d = bigDi/10);

Do I have the wrong includes?

Jon

On 2/28/2023 4:55 PM, Revar Desmera wrote:

If you already have the path, then you can use BOSL2’s path_copies()
to get an equidistant spread of items along that path.

7f60f080-3992-11eb-9baf-22e99510b07f.png
distributors.scad
https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies
github.com
https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies

https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies

-Revar

On Feb 28, 2023, at 7:40 AM, jon jon@jonbondy.com wrote:

I wrote some code to create a spiral of spheres around the surface
of a larger sphere.  It works fine, but the spacing is too tight near
the poles.

If I were writing in a "normal" language, I would calculate the
position of each possible new sphere, then calculate the distance
from that sphere to the most recently successfully placed sphere, and
avoid placing the new one if the distance was too small.  But I am
writing in OpenSCAD, so that approach will not work; at least, I
don't know how to do this in OpenSCAD.

Any thoughts?

function x(r, theta, rho) = r * sin(theta) * cos(rho);
function y(r, theta, rho) = r * sin(theta) * sin(rho);
function z(r, theta, rho) = r * cos(theta);

sphereD = 5;
numRots = 7;
numSpheres = numRots * 360;
r = 100;
for (rho = [0:5:numSpheres])
    let (theta = (180 * (rho / numSpheres)))
        translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)])
            sphere(d = sphereD);


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

Thank you, Revar! When I do this include <BOSL2/std.scad> include <BOSL2/distributors.scad> then I get the error WARNING: Ignoring unknown module 'path_copies' in file xxx.scad, line 43 which is path_copies(path, n = 100) sphere(d = bigDi/10); Do I have the wrong includes? Jon On 2/28/2023 4:55 PM, Revar Desmera wrote: > If you already have the path, then you can use BOSL2’s `path_copies()` > to get an equidistant spread of items along that path. > > 7f60f080-3992-11eb-9baf-22e99510b07f.png > distributors.scad > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > github.com > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > > -Revar > > >> On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com> wrote: >> >> I wrote some code to create a spiral of spheres around the surface >> of a larger sphere.  It works fine, but the spacing is too tight near >> the poles. >> >> If I were writing in a "normal" language, I would calculate the >> position of each possible new sphere, then calculate the distance >> from that sphere to the most recently successfully placed sphere, and >> avoid placing the new one if the distance was too small.  But I am >> writing in OpenSCAD, so that approach will not work; at least, I >> don't know how to do this in OpenSCAD. >> >> Any thoughts? >> >> >> >> function x(r, theta, rho) = r * sin(theta) * cos(rho); >> function y(r, theta, rho) = r * sin(theta) * sin(rho); >> function z(r, theta, rho) = r * cos(theta); >> >> sphereD = 5; >> numRots = 7; >> numSpheres = numRots * 360; >> r = 100; >> for (rho = [0:5:numSpheres]) >>     let (theta = (180 * (rho / numSpheres))) >>         translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)]) >>             sphere(d = sphereD); >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
AM
Adrian Mariano
Tue, Feb 28, 2023 10:40 PM

I assumed that he really wants a nice result on the sphere.  The
path_copies() module implements something like what nophead
suggested----his suggestion, by the way, is really kind of nontrivial to
implement.

On Tue, Feb 28, 2023 at 5:12 PM Revar Desmera revarbat@gmail.com wrote:

If you already have the path, then you can use BOSL2’s path_copies() to
get an equidistant spread of items along that path.

[image: 7f60f080-3992-11eb-9baf-22e99510b07f.png]

distributors.scad
https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies
github.com
https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies

https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies

-Revar

On Feb 28, 2023, at 7:40 AM, jon jon@jonbondy.com wrote:

I wrote some code to create a spiral of spheres around the surface of a
larger sphere.  It works fine, but the spacing is too tight near the poles.

If I were writing in a "normal" language, I would calculate the position
of each possible new sphere, then calculate the distance from that sphere
to the most recently successfully placed sphere, and avoid placing the new
one if the distance was too small.  But I am writing in OpenSCAD, so that
approach will not work; at least, I don't know how to do this in OpenSCAD.

Any thoughts?

function x(r, theta, rho) = r * sin(theta) * cos(rho);
function y(r, theta, rho) = r * sin(theta) * sin(rho);
function z(r, theta, rho) = r * cos(theta);

sphereD = 5;
numRots = 7;
numSpheres = numRots * 360;
r = 100;
for (rho = [0:5:numSpheres])
let (theta = (180 * (rho / numSpheres)))
translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)])
sphere(d = sphereD);


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I assumed that he really wants a nice result on the sphere. The path_copies() module implements something like what nophead suggested----his suggestion, by the way, is really kind of nontrivial to implement. On Tue, Feb 28, 2023 at 5:12 PM Revar Desmera <revarbat@gmail.com> wrote: > If you already have the path, then you can use BOSL2’s `path_copies()` to > get an equidistant spread of items along that path. > > [image: 7f60f080-3992-11eb-9baf-22e99510b07f.png] > > distributors.scad > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > github.com > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > > -Revar > > > On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com> wrote: > > I wrote some code to create a spiral of spheres around the surface of a > larger sphere. It works fine, but the spacing is too tight near the poles. > > If I were writing in a "normal" language, I would calculate the position > of each possible new sphere, then calculate the distance from that sphere > to the most recently successfully placed sphere, and avoid placing the new > one if the distance was too small. But I am writing in OpenSCAD, so that > approach will not work; at least, I don't know how to do this in OpenSCAD. > > Any thoughts? > > > > function x(r, theta, rho) = r * sin(theta) * cos(rho); > function y(r, theta, rho) = r * sin(theta) * sin(rho); > function z(r, theta, rho) = r * cos(theta); > > sphereD = 5; > numRots = 7; > numSpheres = numRots * 360; > r = 100; > for (rho = [0:5:numSpheres]) > let (theta = (180 * (rho / numSpheres))) > translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)]) > sphere(d = sphereD); > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Tue, Feb 28, 2023 10:43 PM

You only need std.scad.  Probably you need to update BOSL2.

On Tue, Feb 28, 2023 at 5:39 PM jon jon@jonbondy.com wrote:

Thank you, Revar!

When I do this

include <BOSL2/std.scad>
include <BOSL2/distributors.scad>

then I get the error

WARNING: Ignoring unknown module 'path_copies' in file xxx.scad, line 43

which is

path_copies(path, n = 100) sphere(d = bigDi/10);

Do I have the wrong includes?

Jon

On 2/28/2023 4:55 PM, Revar Desmera wrote:

If you already have the path, then you can use BOSL2’s path_copies() to
get an equidistant spread of items along that path.

[image: 7f60f080-3992-11eb-9baf-22e99510b07f.png]

distributors.scad
https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies
github.com
https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies

https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies

-Revar

On Feb 28, 2023, at 7:40 AM, jon jon@jonbondy.com jon@jonbondy.com
wrote:

I wrote some code to create a spiral of spheres around the surface of a
larger sphere.  It works fine, but the spacing is too tight near the poles.

If I were writing in a "normal" language, I would calculate the position
of each possible new sphere, then calculate the distance from that sphere
to the most recently successfully placed sphere, and avoid placing the new
one if the distance was too small.  But I am writing in OpenSCAD, so that
approach will not work; at least, I don't know how to do this in OpenSCAD.

Any thoughts?

function x(r, theta, rho) = r * sin(theta) * cos(rho);
function y(r, theta, rho) = r * sin(theta) * sin(rho);
function z(r, theta, rho) = r * cos(theta);

sphereD = 5;
numRots = 7;
numSpheres = numRots * 360;
r = 100;
for (rho = [0:5:numSpheres])
let (theta = (180 * (rho / numSpheres)))
translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)])
sphere(d = sphereD);


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

You only need std.scad. Probably you need to update BOSL2. On Tue, Feb 28, 2023 at 5:39 PM jon <jon@jonbondy.com> wrote: > Thank you, Revar! > > When I do this > > include <BOSL2/std.scad> > include <BOSL2/distributors.scad> > > then I get the error > > WARNING: Ignoring unknown module 'path_copies' in file xxx.scad, line 43 > > which is > > path_copies(path, n = 100) sphere(d = bigDi/10); > > Do I have the wrong includes? > > Jon > > > On 2/28/2023 4:55 PM, Revar Desmera wrote: > > If you already have the path, then you can use BOSL2’s `path_copies()` to > get an equidistant spread of items along that path. > > [image: 7f60f080-3992-11eb-9baf-22e99510b07f.png] > > distributors.scad > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > github.com > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > > <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> > > -Revar > > > On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com> <jon@jonbondy.com> > wrote: > > I wrote some code to create a spiral of spheres around the surface of a > larger sphere. It works fine, but the spacing is too tight near the poles. > > If I were writing in a "normal" language, I would calculate the position > of each possible new sphere, then calculate the distance from that sphere > to the most recently successfully placed sphere, and avoid placing the new > one if the distance was too small. But I am writing in OpenSCAD, so that > approach will not work; at least, I don't know how to do this in OpenSCAD. > > Any thoughts? > > > > function x(r, theta, rho) = r * sin(theta) * cos(rho); > function y(r, theta, rho) = r * sin(theta) * sin(rho); > function z(r, theta, rho) = r * cos(theta); > > sphereD = 5; > numRots = 7; > numSpheres = numRots * 360; > r = 100; > for (rho = [0:5:numSpheres]) > let (theta = (180 * (rho / numSpheres))) > translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)]) > sphere(d = sphereD); > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
J
jon
Tue, Feb 28, 2023 11:18 PM

Yes.  Updated the library, and the path_copies() approach worked perfectly!

I love that BOSL2 library!

Jon

On 2/28/2023 5:43 PM, Adrian Mariano wrote:

You only need std.scad.  Probably you need to update BOSL2.

On Tue, Feb 28, 2023 at 5:39 PM jon jon@jonbondy.com wrote:

 Thank you, Revar!

 When I do this

 include <BOSL2/std.scad>
 include <BOSL2/distributors.scad>

 then I get the error

 WARNING: Ignoring unknown module 'path_copies' in file xxx.scad,
 line 43

 which is

 path_copies(path, n = 100) sphere(d = bigDi/10);

 Do I have the wrong includes?

 Jon


 On 2/28/2023 4:55 PM, Revar Desmera wrote:
 If you already have the path, then you can use BOSL2’s
 `path_copies()` to get an equidistant spread of items along that
 path.

 7f60f080-3992-11eb-9baf-22e99510b07f.png
 distributors.scad
 <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies>
 github.com
 <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies>

 <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies>

 -Revar
 On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com>
 <mailto:jon@jonbondy.com> wrote:

 I wrote some code to create a spiral of spheres around the
 surface of a larger sphere.  It works fine, but the spacing is
 too tight near the poles.

 If I were writing in a "normal" language, I would calculate the
 position of each possible new sphere, then calculate the
 distance from that sphere to the most recently successfully
 placed sphere, and avoid placing the new one if the distance was
 too small.  But I am writing in OpenSCAD, so that approach will
 not work; at least, I don't know how to do this in OpenSCAD.

 Any thoughts?



 function x(r, theta, rho) = r * sin(theta) * cos(rho);
 function y(r, theta, rho) = r * sin(theta) * sin(rho);
 function z(r, theta, rho) = r * cos(theta);

 sphereD = 5;
 numRots = 7;
 numSpheres = numRots * 360;
 r = 100;
 for (rho = [0:5:numSpheres])
     let (theta = (180 * (rho / numSpheres)))
         translate([x(r, theta, rho), y(r, theta, rho), z(r,
 theta, rho)])
             sphere(d = sphereD);
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email todiscuss-leave@lists.openscad.org
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

Yes.  Updated the library, and the path_copies() approach worked perfectly! I love that BOSL2 library! Jon On 2/28/2023 5:43 PM, Adrian Mariano wrote: > You only need std.scad.  Probably you need to update BOSL2. > > On Tue, Feb 28, 2023 at 5:39 PM jon <jon@jonbondy.com> wrote: > > Thank you, Revar! > > When I do this > > include <BOSL2/std.scad> > include <BOSL2/distributors.scad> > > then I get the error > > WARNING: Ignoring unknown module 'path_copies' in file xxx.scad, > line 43 > > which is > > path_copies(path, n = 100) sphere(d = bigDi/10); > > Do I have the wrong includes? > > Jon > > > On 2/28/2023 4:55 PM, Revar Desmera wrote: >> If you already have the path, then you can use BOSL2’s >> `path_copies()` to get an equidistant spread of items along that >> path. >> >> 7f60f080-3992-11eb-9baf-22e99510b07f.png >> distributors.scad >> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >> github.com >> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >> >> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >> >> -Revar >> >> >>> On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com> >>> <mailto:jon@jonbondy.com> wrote: >>> >>> I wrote some code to create a spiral of spheres around the >>> surface of a larger sphere.  It works fine, but the spacing is >>> too tight near the poles. >>> >>> If I were writing in a "normal" language, I would calculate the >>> position of each possible new sphere, then calculate the >>> distance from that sphere to the most recently successfully >>> placed sphere, and avoid placing the new one if the distance was >>> too small.  But I am writing in OpenSCAD, so that approach will >>> not work; at least, I don't know how to do this in OpenSCAD. >>> >>> Any thoughts? >>> >>> >>> >>> function x(r, theta, rho) = r * sin(theta) * cos(rho); >>> function y(r, theta, rho) = r * sin(theta) * sin(rho); >>> function z(r, theta, rho) = r * cos(theta); >>> >>> sphereD = 5; >>> numRots = 7; >>> numSpheres = numRots * 360; >>> r = 100; >>> for (rho = [0:5:numSpheres]) >>>     let (theta = (180 * (rho / numSpheres))) >>>         translate([x(r, theta, rho), y(r, theta, rho), z(r, >>> theta, rho)]) >>>             sphere(d = sphereD); >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email todiscuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Wed, Mar 1, 2023 4:42 PM

is this what you were trying to do?
[image: Screenshot 2023-03-01 at 10.00.00 PM.png]

I did this with a slightly different approach.
steps:

  1. created a normal helix
  2. connected all helix points with the center line z-axis, so that all the
    lines are parallel to x-y plane
  3. found intersection of the lines with sphere. This gives the helical path
    along the sphere surface
  4. Divided the path in equally spaced points.
  5. translated spheres with diameter equal to the length between each point

On Wed, 1 Mar 2023 at 04:49, jon jon@jonbondy.com wrote:

Yes.  Updated the library, and the path_copies() approach worked perfectly!

I love that BOSL2 library!

Jon
On 2/28/2023 5:43 PM, Adrian Mariano wrote:

You only need std.scad.  Probably you need to update BOSL2.

On Tue, Feb 28, 2023 at 5:39 PM jon jon@jonbondy.com wrote:

Thank you, Revar!

When I do this

include <BOSL2/std.scad>
include <BOSL2/distributors.scad>

then I get the error

WARNING: Ignoring unknown module 'path_copies' in file xxx.scad, line 43

which is

path_copies(path, n = 100) sphere(d = bigDi/10);

Do I have the wrong includes?

Jon

On 2/28/2023 4:55 PM, Revar Desmera wrote:

If you already have the path, then you can use BOSL2’s path_copies() to
get an equidistant spread of items along that path.

[image: 7f60f080-3992-11eb-9baf-22e99510b07f.png]

distributors.scad
https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies
github.com
https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies

https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies

-Revar

On Feb 28, 2023, at 7:40 AM, jon jon@jonbondy.com jon@jonbondy.com
wrote:

I wrote some code to create a spiral of spheres around the surface of a
larger sphere.  It works fine, but the spacing is too tight near the poles.

If I were writing in a "normal" language, I would calculate the position
of each possible new sphere, then calculate the distance from that sphere
to the most recently successfully placed sphere, and avoid placing the new
one if the distance was too small.  But I am writing in OpenSCAD, so that
approach will not work; at least, I don't know how to do this in OpenSCAD.

Any thoughts?

function x(r, theta, rho) = r * sin(theta) * cos(rho);
function y(r, theta, rho) = r * sin(theta) * sin(rho);
function z(r, theta, rho) = r * cos(theta);

sphereD = 5;
numRots = 7;
numSpheres = numRots * 360;
r = 100;
for (rho = [0:5:numSpheres])
let (theta = (180 * (rho / numSpheres)))
translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)])
sphere(d = sphereD);


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

is this what you were trying to do? [image: Screenshot 2023-03-01 at 10.00.00 PM.png] I did this with a slightly different approach. steps: 1. created a normal helix 2. connected all helix points with the center line z-axis, so that all the lines are parallel to x-y plane 3. found intersection of the lines with sphere. This gives the helical path along the sphere surface 4. Divided the path in equally spaced points. 5. translated spheres with diameter equal to the length between each point On Wed, 1 Mar 2023 at 04:49, jon <jon@jonbondy.com> wrote: > Yes. Updated the library, and the path_copies() approach worked perfectly! > > I love that BOSL2 library! > > Jon > On 2/28/2023 5:43 PM, Adrian Mariano wrote: > > You only need std.scad. Probably you need to update BOSL2. > > On Tue, Feb 28, 2023 at 5:39 PM jon <jon@jonbondy.com> wrote: > >> Thank you, Revar! >> >> When I do this >> >> include <BOSL2/std.scad> >> include <BOSL2/distributors.scad> >> >> then I get the error >> >> WARNING: Ignoring unknown module 'path_copies' in file xxx.scad, line 43 >> >> which is >> >> path_copies(path, n = 100) sphere(d = bigDi/10); >> >> Do I have the wrong includes? >> >> Jon >> >> >> On 2/28/2023 4:55 PM, Revar Desmera wrote: >> >> If you already have the path, then you can use BOSL2’s `path_copies()` to >> get an equidistant spread of items along that path. >> >> [image: 7f60f080-3992-11eb-9baf-22e99510b07f.png] >> >> distributors.scad >> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >> github.com >> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >> >> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >> >> -Revar >> >> >> On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com> <jon@jonbondy.com> >> wrote: >> >> I wrote some code to create a spiral of spheres around the surface of a >> larger sphere. It works fine, but the spacing is too tight near the poles. >> >> If I were writing in a "normal" language, I would calculate the position >> of each possible new sphere, then calculate the distance from that sphere >> to the most recently successfully placed sphere, and avoid placing the new >> one if the distance was too small. But I am writing in OpenSCAD, so that >> approach will not work; at least, I don't know how to do this in OpenSCAD. >> >> Any thoughts? >> >> >> >> function x(r, theta, rho) = r * sin(theta) * cos(rho); >> function y(r, theta, rho) = r * sin(theta) * sin(rho); >> function z(r, theta, rho) = r * cos(theta); >> >> sphereD = 5; >> numRots = 7; >> numSpheres = numRots * 360; >> r = 100; >> for (rho = [0:5:numSpheres]) >> let (theta = (180 * (rho / numSpheres))) >> translate([x(r, theta, rho), y(r, theta, rho), z(r, theta, rho)]) >> sphere(d = sphereD); >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
J
jon
Wed, Mar 1, 2023 5:21 PM

Yes, Sanjeev, that was my objective.  Basically a single line of
additional code using BOSL2

Jon

On 3/1/2023 11:42 AM, Sanjeev Prabhakar wrote:

is this what you were trying to do?
Screenshot 2023-03-01 at 10.00.00 PM.png

I did this with a slightly different approach.
steps:

  1. created a normal helix
  2. connected all helix points with the center line z-axis, so that all
    the lines are parallel to x-y plane
  3. found intersection of the lines with sphere. This gives the helical
    path along the sphere surface
  4. Divided the path in equally spaced points.
  5. translated spheres with diameter equal to the length between each point

On Wed, 1 Mar 2023 at 04:49, jon jon@jonbondy.com wrote:

 Yes.  Updated the library, and the path_copies() approach worked
 perfectly!

 I love that BOSL2 library!

 Jon

 On 2/28/2023 5:43 PM, Adrian Mariano wrote:
 You only need std.scad.  Probably you need to update BOSL2.

 On Tue, Feb 28, 2023 at 5:39 PM jon <jon@jonbondy.com> wrote:

     Thank you, Revar!

     When I do this

     include <BOSL2/std.scad>
     include <BOSL2/distributors.scad>

     then I get the error

     WARNING: Ignoring unknown module 'path_copies' in file
     xxx.scad, line 43

     which is

     path_copies(path, n = 100) sphere(d = bigDi/10);

     Do I have the wrong includes?

     Jon


     On 2/28/2023 4:55 PM, Revar Desmera wrote:
     If you already have the path, then you can use BOSL2’s
     `path_copies()` to get an equidistant spread of items along
     that path.

     7f60f080-3992-11eb-9baf-22e99510b07f.png
     distributors.scad
     <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies>
     github.com
     <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies>

     <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies>

     -Revar
     On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com>
     <mailto:jon@jonbondy.com> wrote:

     I wrote some code to create a spiral of spheres around the
     surface of a larger sphere.  It works fine, but the spacing
     is too tight near the poles.

     If I were writing in a "normal" language, I would calculate
     the position of each possible new sphere, then calculate
     the distance from that sphere to the most recently
     successfully placed sphere, and avoid placing the new one
     if the distance was too small.  But I am writing in
     OpenSCAD, so that approach will not work; at least, I don't
     know how to do this in OpenSCAD.

     Any thoughts?



     function x(r, theta, rho) = r * sin(theta) * cos(rho);
     function y(r, theta, rho) = r * sin(theta) * sin(rho);
     function z(r, theta, rho) = r * cos(theta);

     sphereD = 5;
     numRots = 7;
     numSpheres = numRots * 360;
     r = 100;
     for (rho = [0:5:numSpheres])
         let (theta = (180 * (rho / numSpheres)))
             translate([x(r, theta, rho), y(r, theta, rho), z(r,
     theta, rho)])
                 sphere(d = sphereD);
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to
     discuss-leave@lists.openscad.org
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email todiscuss-leave@lists.openscad.org
     _______________________________________________
     OpenSCAD mailing list
     To unsubscribe send an email to discuss-leave@lists.openscad.org


 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email todiscuss-leave@lists.openscad.org
 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

Yes, Sanjeev, that was my objective.  Basically a single line of additional code using BOSL2 Jon On 3/1/2023 11:42 AM, Sanjeev Prabhakar wrote: > is this what you were trying to do? > Screenshot 2023-03-01 at 10.00.00 PM.png > > I did this with a slightly different approach. > steps: > 1. created a normal helix > 2. connected all helix points with the center line z-axis, so that all > the lines are parallel to x-y plane > 3. found intersection of the lines with sphere. This gives the helical > path along the sphere surface > 4. Divided the path in equally spaced points. > 5. translated spheres with diameter equal to the length between each point > > > > On Wed, 1 Mar 2023 at 04:49, jon <jon@jonbondy.com> wrote: > > Yes.  Updated the library, and the path_copies() approach worked > perfectly! > > I love that BOSL2 library! > > Jon > > On 2/28/2023 5:43 PM, Adrian Mariano wrote: >> You only need std.scad.  Probably you need to update BOSL2. >> >> On Tue, Feb 28, 2023 at 5:39 PM jon <jon@jonbondy.com> wrote: >> >> Thank you, Revar! >> >> When I do this >> >> include <BOSL2/std.scad> >> include <BOSL2/distributors.scad> >> >> then I get the error >> >> WARNING: Ignoring unknown module 'path_copies' in file >> xxx.scad, line 43 >> >> which is >> >> path_copies(path, n = 100) sphere(d = bigDi/10); >> >> Do I have the wrong includes? >> >> Jon >> >> >> On 2/28/2023 4:55 PM, Revar Desmera wrote: >>> If you already have the path, then you can use BOSL2’s >>> `path_copies()` to get an equidistant spread of items along >>> that path. >>> >>> 7f60f080-3992-11eb-9baf-22e99510b07f.png >>> distributors.scad >>> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >>> github.com >>> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >>> >>> <https://github.com/revarbat/BOSL2/wiki/distributors.scad#functionmodule-path_copies> >>> >>> -Revar >>> >>> >>>> On Feb 28, 2023, at 7:40 AM, jon <jon@jonbondy.com> >>>> <mailto:jon@jonbondy.com> wrote: >>>> >>>> I wrote some code to create a spiral of spheres around the >>>> surface of a larger sphere.  It works fine, but the spacing >>>> is too tight near the poles. >>>> >>>> If I were writing in a "normal" language, I would calculate >>>> the position of each possible new sphere, then calculate >>>> the distance from that sphere to the most recently >>>> successfully placed sphere, and avoid placing the new one >>>> if the distance was too small.  But I am writing in >>>> OpenSCAD, so that approach will not work; at least, I don't >>>> know how to do this in OpenSCAD. >>>> >>>> Any thoughts? >>>> >>>> >>>> >>>> function x(r, theta, rho) = r * sin(theta) * cos(rho); >>>> function y(r, theta, rho) = r * sin(theta) * sin(rho); >>>> function z(r, theta, rho) = r * cos(theta); >>>> >>>> sphereD = 5; >>>> numRots = 7; >>>> numSpheres = numRots * 360; >>>> r = 100; >>>> for (rho = [0:5:numSpheres]) >>>>     let (theta = (180 * (rho / numSpheres))) >>>>         translate([x(r, theta, rho), y(r, theta, rho), z(r, >>>> theta, rho)]) >>>>             sphere(d = sphereD); >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> To unsubscribe send an email to >>>> discuss-leave@lists.openscad.org >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email todiscuss-leave@lists.openscad.org >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email todiscuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org