Here is a translation of the code. Colors are not yet possible, see http://trac.sagemath.org/ticket/12212
"""
Code traduit depuis Maple, le code original est ici:
http://www.maplesoft.com/applications/view.aspx?SID=3851&view=html#mapleautobookmark9
REFERENCES:
A. Cortie : *Digital Seashells* Comput & Graphics Vol 17 , pp. 79-84 (1993)
"""
pi = float(pi)
def rad(aa):
"""
conversion degres -- radians
"""
return float(aa) / 360 * 2 * pi
def Natalina():
"""
un modele simple
"""
dic = {'D': 1,
'alpha': rad(80),
'beta': rad(40),
'phi': rad(55),
'mu': rad(10),
'Omega': rad(30),
'A': 25, 'a': 12, 'b': 16, 'P': 0, 'L': 0}
srange = (rad(-270), rad(80))
trange = (-2 * pi, 4 * pi)
grid = [100, 100]
return dic, srange, trange, grid
def Lyria():
"""
un autre modele
"""
dic = {'D': 1, 'alpha':rad(83.9), 'beta':rad(-19),
'phi': rad(45), 'mu':rad(1),
'Omega': rad(-2), 'A':50, 'a':40, 'b':14, 'P':0, 'L':8,
'W1': rad(6),
'W2': rad(27), 'N':8}
srange = (rad(-51), rad(9))
trange = (-4 * pi, 4 * pi)
grid = [80, 150]
return dic, srange, trange, grid
def Turritella():
"""
un autre modele
"""
dic = {'D': 1, 'alpha': rad(88.9), 'beta': rad(4), 'phi': rad(55),
'mu': rad(1),
'Omega': rad(-2), 'A': 22.2, 'a': 1.3, 'b': 1.5, 'P': 0, 'L': 0};
srange = (rad(-267), rad(39))
trange = (-30 * pi, 4 * pi)
grid = [30, 250]
return dic, srange, trange, grid
def Oxystele():
"""
"""
dic = {'D': 1, 'alpha': rad(84.9), 'beta': rad(7), 'phi': rad(-36),
'mu': rad(1),
'Omega': rad(-2), 'A': 47, 'a': 40, 'b': 19, 'P': 0, 'L': 0,
'W1': 6, 'W2': 27, 'N': 8}
srange = (rad(-70),rad(70))
trange = (-20 * pi, 4 * pi)
grid = [40, 150]
return dic, srange, trange, grid
def Nautilus():
"""
"""
dic = {'D': 1, 'alpha': rad(80), 'beta': rad(90), 'phi': rad(0),
'mu': rad(0), 'Omega': rad(0), 'A': 2,
'a': 2, 'b': 1.5, 'P': 0, 'L': 0}
srange = (rad(-163),rad(163))
trange = (pi, 4 * pi)
grid = [30, 60]
return dic, srange, trange, grid
def Planorbis():
"""
"""
dic = {'D': 1, 'alpha': rad(84), 'beta': rad(85), 'phi': rad(10),
'mu': rad(45), 'Omega': rad(5) , 'A': 45, 'a': 20, 'b': 30,
'P': 0, 'L': 0, 'W1': 6, 'W2': 27, 'N': 8}
srange = (rad(-150), rad(130))
trange = (-pi, 4 * pi)
grid = [40, 60]
return dic, srange, trange, grid
def Ammonite():
"""
"""
dic = {'D': 1, 'alpha': rad(83), 'beta': rad(90), 'phi': rad(1),
'mu': rad(1), 'Omega': rad(1), 'A': 2.5, 'a': 1, 'b': 0.9,
'P': 10, 'W1': 100, 'W2': 20, 'N': 15, 'L': 1/2}
srange = (rad(-170), rad(170))
trange = (-pi, 4 * pi)
grid = [40, 60]
return dic, srange, trange, grid
def Conus():
"""
"""
dic = {'D': 1, 'alpha': rad(87), 'beta': rad(7), 'phi': rad(78),
'mu': rad(0), 'Omega': rad(0), 'A': 7, 'a': 4.3, 'b': 1,
'P': 0, 'L': 0, 'W1': 6, 'W2': 27, 'N': 8}
srange = (rad(-180),rad(2))
trange = (-12 * pi, 4 * pi)
grid = [60, 80]
return dic, srange, trange, grid ...
(more)
This question is much more specific than the title suggests. Perhaps the title should be altered. People who are interested in translating Maple code to sage in general will fall upon this page. Those people might benefit from visiting https://doc.sagemath.org/html/en/refe... instead.