Full Version: Doyle spirals, Doyle flower

From: bemfarmer [#1]
 30 Jul 2019

>>> For MoI4beta only<<<

Link to Jos Leys paper with description and pictures of Doyle spirals:

I've been studying the Doyle spirals extensively, and to assist with understanding, wrote a simple script to expand a 3 circle Doyle cell into a Doyle flower,
and by much repetition, into a Doyle spiral. The script requires 3 starter circles, preferably with coherent sizes.
A coherent starter set of 3 circles for (p,q) = (3,8) is attached in the zip. The attractor point of the spiral is at (0,0).

The script employs a "new" input method, double clicking on circles. Circle TanTan factory is used, the basis of the Circle TanTan command in MoI.
The first click of the double click selects the first Circle TanTan point. The second click selects the circle, and the point can be the same point as the first click.
The second click automatically fulfills the second prompt.
(The two clicks can be separate.)
Next, for the third prompt, is another double click. The first (3rd) click selects the second TanTan point of the second circle. The second (4th) click selects the second circle, and the point can be the same point as the first (3th) click.
The second (4th) click automatically fulfills the fourth prompt
(The two clicks can be separate.)
The fifth click selects the opposite circle.
Then a NEW tangent circle will appear.
The selection relies on the same tantan picking as Circle TanTan, so if the new circle does not appear, or is in the wrong place, try again.
The creating of the new circle is very reliable, but occasionally the new circle is in the wrong place, due to incorrect TanTan approximate points being selected.

Doyle flower script, by Brian McMillin, July 2019.

A terminal deselect of the circles may be in order?

The script can be put in the %AppData% command folder, to be accessible via custom.ui.
The script uses two MoI4Beta methods .isCircle, and .conicRadius, and so does not work in MoI3.

The traditional Doyle flower begins with 3 externally mutually tangent circles:
Circle C with radius R0. Circle C centered at (x,y) = (1,0).
Circle A with radius R1. Radii are nonzero.
Circle B with radius R2.
A and B also are complex numbers in the Argand plane, and A and B are the centers of circles A and B.
New Circle C3 will be tangent to C and B, and R3 = R0*R2/R1.
With attractor point w0 located at the origin, R0 will be less than 1 unit.

General form for a new circle petal in "cheek" or "cleft" of two adjoining circles:
Let 3 externally mutually tangent circles C0, C1, and C2, have radii of R0, R1, and R2, respectively. There is a "cheek" areas formed by the pair of adjacent circles, C0 and C1, where a tan/tan circle C3, of radius R3, may be added. Let the circle opposite the cheek of adjCircle1 (C0), and adjCircle2 (C1), be labelled oppCircle (C2). Then for new tan/tan circle C3, its radius = R3.
R3 = radius_adjCircle1 * radius_adjCircle2 / radius_oppCircle.
(There are two more "cheek" areas, where circles C4 and C5 may be created, with differently defined combinations of adjacent and opposite circles.)

To avoid eventual overlapping/crossing non-disjoint circles, to insure coherent Doyle spirals, the spiral arm counts "p" and "q" must be used to calculate with numeric methods the complex number center values for the centerpoints of A and B, as well as the radius of the center circle of the flower.

The Doyle flower script is a learning tool.
Next to be done is DoylePQ script to numerically solve for the coherency condition.
and then also, a script to built the Doyle spiral.
Then maybe a moebius transform and double spiral...
Also, a script to replace circles with spheres of matching radii, orient-able, would be helpful.

A javascript implementation, both of coherency and spiral building.
For given values of p and q, the 5 numbers from his numeric Doyle solver can be pasted into MoI Circle center command, to create the coherent circles A, B, and C.
First plot circle C of radius "r", located at center (1,0) in Top View. Then Tab copy paste the two numbers (x,y) for the center of circle A. The z coordinate is automatically zero.
Similarly for circle B.
His solver almost looks like it coud be #include in a MoI script, maybe by deleting a few ()? But there is no license.

There is also a mathematica implementation. (With MIT license, per the site.)
I've finally figured out all of the equations. The 3 papers/implementations use the SAME equations, but the notation varies.
I've also written a seven page pdf. It starts getting repetitious after a while:-)

- Brian



From: Mindset (IGNITER) [#2]
 31 Jul 2019

Hey Bemfarmer,

You contribute some might awesome stuff. but this one has me baffled.
I'd really like to use it.
Maybe someone can make a little tutorial... please?

Thanks for all you do.
-- MindSet


From: Frenchy Pilou (PILOU) [#3]
 31 Jul 2019

Put the 2 files inside moi/commands...Launch moi3D

Press Tab then write _DoyleFlower (with any big letters but without space) or make a ShortCut _DoyleFlower on the second column...

Double Click on any circle, again on another tangent one then third click somewhere on the opposite side...etc...
Practical to press Right Mouse Button for recall the function! ;)

You can also draw any 3 circles (tangent or not) : it's sufficient for start the drawing!

PS You have also the native Function Tangent Circle for complete the Toolset! ;)


From: bemfarmer [#4]
 31 Jul 2019

Hi Mindset,

Pilou made an excellent tutorial.

Assuming the initial 3 circles are in the coherent ratio, for maintaining radius ratios, i.e. to maintain external tangency, without circle overlap, the third circle selected would be the circle tangent in the opposite cleft.
Selecting a different 3rd circle, of different radius from the opposite circle, may be done at the whim of the user, but the resulting new circle will not maintain the coherency.

Spirals start with the circle centered at (1,0). To make a spiral with this script, to add one circle to the spiral, it is necessary to make two new circles, (usually), in order to have the helper circle for the next spiral circle. If p = q is used to set up coherence, with a 3rd party solver, the "spirals" are actually rings of circles, kind of like a spiral without curvature.

- Brian

After creating the new circle, right click will re-activate the Doyle flower script. (Pilou mentioned this "recall the function".)

Also after creating the new circle, it might be nice to have a deselectAll added to the Doyle flower script, but it is not essential.

A new script would automatically create the whole Doyle spiral, given user input parameters, with a few lines of code. Yet to be written or adapted from the abstruse mathematica code, to javascript. I'll work some more on a new script, after the bookkeeping gets done:-)
(Powers of the A (or B) circle centerpoint, as complex numbers, create spirals of center points of circles.)

Notepad++ prefers centre to center:-)

- Brian

It is amazing to me that a few simple circles have let to the many abstruse mathematical papers on the subject.


From: Mindset (IGNITER) [#5]
 1 Aug 2019

Thank you Bemfarmer and thank you Pilou.

I look forward to following this thread with great anticipation.

Again, thank you very much.


From: bemfarmer [#6]
 22 Feb

Complex numbers in MoI and nodeeditor.

Complex number "w" = "C" = a + b*i, where a and b are real numbers.
Here, i = the square root of -1. So b*i is an imaginary number. Math.pow(i,2) = -1.
There are specific mathematical rules for complex number arithmetic.
Addition and Subtraction.
Reciprocal for negative exponents.
The complex numbers have similarities to vectors, and some differences...

A complex number may be represented in several ways, in nodeeditor and MoI.

For display purposes:
The complex number "w" may be treated as a point "C" in the MoI TopView, with the TopView plane considered to be an Argand plane.
The x_coordinate represents the real component, and the y_coordinate represents the imaginary component without showing i = sqrt(-1).
(The z value of C is absent or ignored.) In this case, C is a point object, a one member objectlist, gold color pip in nodeeditor.

For calculation purposes:
A complex number point ptC may be represented as an Element in a nodeeditor pointarray, a pink color pip in nodeeditor.
PointarrayC = [ptC, ptC1, ...]. The pointarray may have one or more points. Let the zero-ith point be ptC.
ptC = PointarrayC.getElement(0);
ptC = (x, y) = (ptC.data[0], ptC.data[1];
For math purposes, x and y elements may be extracted with the Extract node, or Javascript code from the Extract node.
For calculation purposes, the rules of complex number math must be followed.

For easier calculation purposes, a "duo_numarray", a numarray with only two entries, the x and y values, may be extracted from one point in a pointarray.

For more calculation purposes:
A complex number may also be represented in polar coordinates, as modulus (origin distance = hypotenuse(x,y)) and argument (angle in radians).
Pointarray C = [ mod_C * cos(arg_C), mod_C * sin(arg_C) ]
The modulus of C may be calculated from coordinates (x,y). mod_C = math.sqrt(x*x + y*y).

For Doyle spirals, the circles or spheres are calculated from master complex numbers "A" and "B", and masterRadius = "r".
The complex number centerpoints of circles = Math.pow( A, j ) * Math.pow( B, k ), for ranges of j's and k's.
The radius of a circle "D" = modulus_D * masterRadius.
mod_A and arg_A must be solved for, for given integers "p" and "q". The rest of the complex number centerpoints and radii are obtained by calculation.

It all sounds easy, but has been confusing. And confusing to implement. A node is getting close:-)


From: Frenchy Pilou (PILOU) [#7]
 22 Feb

A cool video about the Complex Number of the above post! ;)


From: bemfarmer [#8]
 22 Feb

Yes, it is superb!


From: bemfarmer [#9]
 28 Feb

I am very happy that my DoyleCell node script is partly working.
It is producing the roots and circle centerpoints and master radius, but with 17 digits.

There may be a problem in nodeeditor with having 17 digits, or decimal digits. (FALSE, NOT A PROBLEM)
Circle node is not working with a radius of 17 decimal digits.
r = 0.43384321812883486

I am trying to apply javascript round to get 14 digits, code from the internet, which so far is not working.

// round(1.005, 2); // 1.01
function round(value, decimals) {
return Number(Math.round(value+'e'+decimals)+'e-'+decimals);

There are some sort of javascript limits on numbers...

Attached is non-functional DoyleCell node.
doylefn.js is a helper function which solves for the two root, which are a modulus and an angle argument,
and is a slightly modified program of Robin Houston. It mimics perlinnoisefn.js.
doylefn.js is supplying the required master numbers.
doylecell.js is the node program.
Place both .js programs in the nodeeditor extension folder.
A little more work is needed...

- Brian
Edit, see functional DoyleCellBasic.zip, 4 posts down.


From: James (JFH) [#10]
 28 Feb


Does this help?


Looking forward to seeing the node.


PS truncating floating point with NE basic/math node may be instructive

Image Attachments:


From: bemfarmer [#11]
 28 Feb

Thank you James.

I was rounding, but not saving the rounded value...
So maybe something is wrong with my numarray...and pointarray...

- Brian


From: bemfarmer [#12]
 29 Feb

Okay, the confusion between Javascript arrays, numarrays, pointarrays, and passed root values is sorted out:-)
There is no problem with the number of decimal places. The previous numarrays and pointarrays were programmed incorrectly.

- Brian

Edit: Attached is a functional DoyleCell node. With helper nodes, the 3 basic circles of the spiral are drawn.
Place doylecell.js and doylefn.js in the nodeeditor extension directory. doylefn.js is not "linked" or "included", but its function is somehow found by nodeeditor.

Next up:
Complex number power math with ptA and ptB, to draw a spiral. Inward and outward circles.
Color/Style gradients.
Double Doyle spiral with two attractors, with moebius transform. (easy...really).
Log curves.
A double slider for p and q. Previous (brief) efforts resulted in failure of mouse to grab one slider.
Spheres will work instead of circles.
Edit multi-page Doyle Spiral pdf again, with derivation of Jos Leys equations.
Might try to get my 27 ratio equations, 18 of which are partial derivatives, to work. (not needed, but there is no license for Robin Houston code AFAIK,
just a message to have fun...)

New nodes could be created, or Macros may be able to do the work...
Might need some complex number math nodes.


- Brian



From: bemfarmer [#13]
 1 Mar

A preliminary Complex number node menu, work in progress.
Contains MultiComplex, short for multiply two complex numbers, which are each in the form of a two-element numarray.

I think it may be easier, in using nodes and macros, to deal with a complex number as a 2-element numarray, rather than a two element pointarray.
Later convert the two-element numarray into a point, which may take a macro or another node...

- Brian



From: bemfarmer [#14]
 2 Mar

Complex math using modulus and argument is promising.
- Brian


From: bemfarmer [#15]
 4 Mar

Using more "ported" code, the Doyle spiral of circles is being formed, but only one arm.
I think that the arms are being calculated, but only the last arm survives.
Saving by .concat of pointarray and .concat of radii numarray, or .push do not seem to work...maybe xlength needs to be set?
So it is back to debugging:-)
- Brian


From: bemfarmer [#16]
 4 Mar

Finally got the DoyleSpirals.js node to work.

The problem was that I had an old version, renamed DoyleSpiralOneArm.js in the extension folder, which functioned partly, and one misnamed variable in the DoyleSpirals.js file, r instead of rMaster. (The old version loaded in the menu as DoyleSpiral.)

(apparently) nodeeditor scans ALL of the .js files in the extensions folder,

so somehow the functions in the old version were interfering with the latest version.
Or, more likely, the old version was running instead of the newer version?
Every time I edited DoyleSpirals.js and copied it to the extensions folder, nothing changed or improved. A few hours of wasted time, but educational.

I finally changed the values of p and q from 3 & 8 to 4 and 6, which revealed that the old version was running.

So a suggestion woule be to get rid of old versions in the extensions folder,
and make a visual modification to the newest version.

- Brian


From: bemfarmer [#17]
 5 Mar

Here is a beta copy of the DoyleSpiral script, which gives basic spirals.
It is a "port" of Robin Houston DoyleSpiral explorer code. The buildArm function code was moved inline, during debugging, and could be separated out.

This script was build by using and modifying the pattern of the previous DoyleCell script, so the Root Solver is still doylefn.js.

There is more work to do.
Adding color styles or gradients, varying by arm would be nice.
Only q_arms are implemented. p_arms are not implemented, which would require exchanging the roles of points a and b.
Right hand spirals would need complex conjugate added, or do it in MoI later.
Moebius transform may be possible by math nodes(?).

Due to increasing seasonal work load, improvements may be slow...

modMin and modMax are essentially modulus boundary circles centered at the origin, and all of the circle centers of the Doyle circles, (or spheres),
occur between these boundaries.
For some large values of p and q, there are circles formed for some quadrants which exceed the modulus boundary of modMax,
for unknown reason.

There is a demo .nod file, which can be loaded to the nodeeditor canvas

"Correct" values for p and q are 1 <=p <=q, with 2<q, but some "incorrect" values for p and q form other circle patterns...
Some other "incorrect" values Alert that a root cannot be calculated.

Place DoyleSpiral.js and doylefn.js in the nodeeditor extensions folder.
It is OK to leave the DoyleCell.js file there, but remove any other old DoyleSpiral.js files.

Place the rudimentary DoyleSpiral.html file in extensions/Documents/EN folder.
With up to date nodeeditor program, the .html file will be view-able under the
nodes right-click info button.

A French version translation could be placed in the FR folder.

- Brian



From: bemfarmer [#18]
 9 Mar

Here is a DoubleDoyleDemo2 spiral, made from nodes, with two attractor points, x = -1 and x = +1.
(Code from Robin Houston was used.)

x=-1 is the regular Doyle attractor, moved from 0 to -1.
x=+1 attractor point represents infinity.

The 4 Macros used were:
1. ConvertCenters.nod (creates 3 points on each existing Doyle circle.)

2. MoebiusTr_0_1_inf_to_neg1_0_1.nod (Moebius transform maps x=0 to x=-1,
maps x=1 to x=0, and maps x=infinity to x=+1. This formula is then applied to all of the 3_point circle points. The mapped sets of 3 points are then run through the MoI's 3_point circle node. One extra step is to get the center Y value of each mapped circle, and mask out those circle which have absolute value greater than 5.5. (The value is supposed to be 10, but the math seems to be working wrong...) This gets rid of huge circles, and two very large circles which appear to be incorrect, for unknown reason.
(Mapped circles are produced, because (extended) circles are mapped to (extended) circles, by the moebius transform.) Note Pilou's video post. The moebius transform represents reverse stereographic projection to a sphere, rotation of the sphere by 90 degrees with a certain axis, and then stereographic projection back to the MoI Top View.
It is sufficient to only map 3 points per original circle.

3. Extract_XY node. This converts a pointarray point into a Duo-numarray, representing a complex number.

4. Extract_2XY nod macro. Same as #3, with two point inputs, and outputs X1 Y1 X2 Y2,

Place the 4 Macros in the Macros folder.
Run the DoubleDoyleDemo2.nod.
(Assumes that DoyleSpiral.js and doylefn.js are already in the extension folder of nodeeditor.)

One other point. The math.hypot may be better and less error prone that the current formula for hypotenuse. (Not tried yet.)

Thing would look much better with colors and planar...

The maxModulus and minModulus were adjusted so that the neighborhood of the two attractor points looked about the same.

Modifying to more extreme values may hang up the computer, but on windows 10, MoI can be closed in Task Manager.


Image Attachments:


From: James (JFH) [#19]
 10 Mar


>"DoubleDoyleDemo2 spiral"
Congrats, This is very cool.

>"Thing would look much better with colors and planar."
Here's a simply way to achieve that. (.nod file attached)

Is it possible to have an input to adjust the distance between the 2 points?
I'm trying to get my head the logic.

Again, great work,

Image Attachments:


From: bemfarmer [#20]
 10 Mar

Hi James,

Thank you for the nice style by circle size version.

When time permits, I'll add some style to the Doyle Spiral node, by arm, or position in arm.
Or gradients.
Adding an indexByArm output, and an indexByPositionInArm output might suffice?

There are two arm possibilities, "rows" or "columns" corresponding to p and q.

Maybe even rotation animation.

MoI scaling would move the two attractors apart.
Note that circle C of the Doyle cell is mapped and relocated from center (1,0) to center (0,0), with mapped A and mapped B circles still tangent.
For a different moebius transformation separation of the attractors, the formulas would have to be recalculated. I think this would be a scaling as well(?).

- Brian

I'll have to try sphere replacement. Cannot remember if such a script was written yet.

p.s. It seems that one circle near -1 does not get colored?


Show messages:  1-20  21-23

Reply to All

Back to thread list | Login

© 2020 Project Beehive Forum