Archimedean Spirals script, Chinese YinYang

Next
 From:  bemfarmer
6906.1 
The Fermat spiral script is now converted into the more general Archimedean spiral, based upon the polar equation r = a * Math.pow( theta, b ).

There are names for four of the spirals.
For the lituus curve, b = -1/2.
For the hyperbolic spiral, b = -1.
For Archimedes' spiral, b = 1.
For Fermat's spiral, b = 1/2.

The script NO LONGER adjusts the aValue by PI, so that half whorls come to the aValue entered, e.g. 6 units. (Removed this division by PI)

The Chinese yinyang symbol is explained as the lengths of the shadow cast by a pole, over the course of a year. Say at high noon.
The shadows vary due to the tilt of the earth. Does the elliptical orbit change the shadow lengths enough to measure?

http://www.chinesefortunecalendar.com/yinyang2.htm

After some study, it becomes clear that the curve is an Archimedes' spiral, with b = 1.
For an aValue of 6, (/PI inside script), the Archimedes spiral matches up exactly with the yinyang curve.
The .3dm shows the red curve rotated slightly to show the match with the blue curve.

- Brian

UPDATE Sept 12, 2014, The ArchimedeanSpirals script is revamped, with Sliders and lots of improvements.
The exponent is the reciprocal, to avoid division by zero.

UPDATE Sept 13, 2014: Replaced the script with MaxSmirnof's 3 improvements, per post #7 and #8.

EDITED: 13 Sep 2014 by BEMFARMER


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6906.2 In reply to 6906.1 
Another perspective:

http://www.researchgate.net/publication/221922302_A_Geomedical_Approach_to_Chinese_Medicine_The_Origin_of_the_Yin-Yang_Symbol

- Brian

The following does not work for negative b:
ArchimedeanSpiral:
_FxGraph3D a*pow(v,(1/b))*cos(v)/PI;c*pow(v,(1/b))*sin(v)/PI;0;0;1;0;6.283185307179586;0;50;6;1;6;U
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6906.3 In reply to 6906.1 
UPDATE Sept 12, 2014, The ArchimedeanSpirals script is revamped, with Sliders and lots of improvements. (See Post #1)
The exponent is now the reciprocal, to avoid division by zero.
The scale is no longer divided by PI, as it does not help unitize spirals other than Archimedes'.
The center point must now be selected.

- Brian

EDITED: 13 Sep 2014 by BEMFARMER

Image Attachments:
Size: 24.6 KB, Downloaded: 45 times, Dimensions: 238x412px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6906.4 In reply to 6906.3 
The family of Archimedean Spirals has the polar equation r = a * Theta(power(b)).
The script avoids using b=1/n, to avoid division by 0 if n=0.
b = the tightness of the Whorls.
For Archimedes' spiral, b = 1. Its inversion is the hyperbolic spiral, b=-1.
For Fermat's spiral, b = 1/2. Its inversion is the lituus, b=-1/2.
Other values of b yield different curves.
The minimum tightness is set to -1.0, because lower values hung up Moi. If b < -1, b = -1
The maximum tightness is set to +3.0.
Fermat's spiral is also known as the parabolic spiral.
The hyperbolic spiral is also known as the reciprocal spiral.
If b = 0, whorls of "circle(s)" forms. (On top of itself)
The "circle" is not quite as perfect as a Moi Nurbs circle.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
6906.5 In reply to 6906.4 
>>The following does not work for negative b:
>>ArchimedeanSpiral:
>>_FxGraph3D a*pow(v,(1/b))*cos(v)/PI;c*pow(v,(1/b))*sin(v)/PI;0;0;1;0;6.283185307179586;0;50;6;1;6;U

Hi Brian

it works, but your settings is not correct.
For example, v=0, b=-2
pow(v,(1/b))*sin(v) = pow(0,-0.5)*sin(0) = infinity * sin(0) = infinity * 0 = indeterminate => math error

to avoid this use minV=0.0001
_FxGraph3D a*pow(v,(1/b))*cos(v)/PI;c*pow(v,(1/b))*sin(v)/PI;0;0;1;0.0001;6.283185307179586;0;100;6;-2;6;U

P.S. Thank you for your scripts! This one is great (as always)

EDITED: 13 Sep 2014 by SMIRNOV

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6906.6 In reply to 6906.5 
Thank you Max. I continue to learn a lot from your professional scripts, even though I do not understand all of their details.

Link to negative exponents: (It is basic algebra :-)
http://www.regentsprep.org/Regents/math/algtrig/ATO1/posnegzles.htm

A couple of questions for Max and Michael:
Somehow, the latest ArchimedeanSpirals script is getting away with theta=0.
So maybe Moi is compensating??
I tried an alert message to see the result of pow, but that prevented the script from working.

The onmousemove slider generates the flashing curves, I would guess from repetitive calculations.
Maybe with some sort of onmousemove (stopped moving), the values could be purged?

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
6906.7 In reply to 6906.6 
Hi Brian!

>>Somehow, the latest ArchimedeanSpirals script is getting away with theta=0.
add line:
if (theta===0) { theta=0.0000001 }

>>The onmousemove slider generates the flashing curves, I would guess from repetitive calculations.
Check the new code (attached)
Use diff tool, or any online tool like http://www.quickdiff.com/

P.S. Thank you for a moi.ui.fireUIEvent command :) I didn't know about it :)

EDITED: 7 Mar 2022 by SMIRNOV

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6906.8 In reply to 6906.7 
Hi Max

Michael provided the code/information on moi.ui.fireUIEvent and onmousemove, for the Clothoid2ptSliders script.
I will try to use your improvements for the Clothoid sliders.

Thank you for the diff tool information.

Checking out your code shows 3 improvement areas.
1. Corrected divide by zero potential error.
2. Greatly reduced slider flickering.
3. Clicking on one of the 4 spiral families switches the spiral to that type.

I am posting a zip of your two files to post #1, replacing the older script.
I need to improve my haphazard version control.

Also, Thank you for your impressive improvements. I had no idea how to do them.

- Brian

EDITED: 13 Sep 2014 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  bemfarmer
6906.9 In reply to 6906.8 
I successfully modified the Clothoid2pt script with the low flicker sliders.
I'll wait a day or two to check it out. It is too late right now.


Also added (for example)

code:
 <td onclick='end_slider.value=180; moi.ui.fireUIEvent("end_slider");'>End Angle:</td> 


to reset the endpoint slider to its midpoint value.

This reset to midpoint value should work on the Spirals, FxGraph3D, and would even work for Blend (?), but I'll leave the latter two alone.

- Brian

EDITED: 14 Sep 2014 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All