View Full Version : Natural things -- TBGL -- geometry
Hi all,
Busy with designing flowers :confused:
the simple question is how to get as many circles/spheres inside a circle/sphere with one single mathematical rule , obviously a concentric building up does not work ,it generates too many gaps.
Simulation how a sunflower arranges its seeds -- interesting fact is that it is generated by the "golden angle" -- this is the angle of a circlesegment that compares to the remaining segment as this one to the complete circle (same as the golden ratio for lines and connected with Fibonacci fib(a,b) -> b,a+b
(you can calculate the golden ratio with the Fibonacci series very easily )
best Rob
(thanks for the updates !! ) -- exec inside the ZIP
(image : SCRcopy , tB running under LINUX :cool:)
Petr Schreiber
10-02-2015, 08:05
Hi Rob,
this is beautiful!
I noticed one thing on the image - there are signs of "tearing". You can see there are 2 horizontal artefacts. How to get rid of those?
TBGL_UseVsync(1) will make sure the image will not get overdrawn before it is finished. Enough to call it once, after TBGL is initialized.
Petr
OffTopic addendum : for those who want more digits
sqrt(5) can be written as a contineous fraction [2;4,4...] so it can be written recursively -- as next
used a Common Lisp compiler with full numeric tower and extended floats : (extended floats upto 2^2147483648 )
Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>
Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010
Type :h and hit Enter for context help.
[1]> (setf (ext:long-float-digits) 2000)
2000
[2]> pi
3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568L0
[3]> (defun s5 (rec)
(if (zerop rec) 0 (/ 1L0 (+ 4L0 (s5 (1- rec)))))) ;; same as [0;4,4 ... ]
S5
[4]> (compile 's5)
S5 ;
NIL ;
NIL
[5]> (defun sqrt5 (rec)
(+ 2L0 (s5 rec)))
SQRT5
[6]> (sqrt5 5)
2.2360681114551083591331269349845201238390092879256965944272445820433436532507739938080495356037151702786377708978328173374613003095975232198142414860681114551083591331269349845201238390092879256965944272445820433436532507739938080495356037151702786377708978328173374613003095975232198142414860681114551083591331269349845201238390092879256965944272445820433436532507739938080495356037151702786377708978328173374613003095975232198142414860681114551083591331269349845201238390092879256965944272445820433436532507739938080495356037151702786377708978328173374613003095975232198142414860681114551083591331269349843L0
[7]> (sqrt 5)
2.236068
[8]> (defun golden-angle-rad (rec)
(* pi (- 3L0 (sqrt5 rec))))
GOLDEN-ANGLE-RAD
[9]> (golden-angle-rad 10)
2.3999632297288795159885038407232372604069134234664827043113346796930876181344423657946941825537733044893649805918042146818577333732747879550531540995953116347594954792661340284540507698833124797380965306312477257696101800476180595078627278415325157922585927453121934257454071017196178363470762447879850784553639027865920837102032009186388708530777595911898614423525845885841822655893995332960957861581839485909053740902309992653373321044592266602327101841175844654712690649807610642673185528081406135673956142289826585640781818063626843002547896454173970403366219678278470279498840747254185798417980125015105L0
[10]> (golden-angle-rad 100)
2.399963229728653322231555506633613853124999011058115042935112750731307338239438790779962060660583963731372962507200214118907789857504980246440576020193933417959284039712230913169038448086783386141516097775717272150257430021175720772656889524541046930984722410930569976028010611981770241644531000661328742906609072918458139361483233571151290609770066629569151908430583083744124946114338406227199480449668648055584082578705366710597735279983410940900427572991022649862270994073083791856087181117685248216068068069844954113762500631063417632937549544722217925614902025699912591758684176017734791664072455325978L0
[11]> (golden-angle-rad 1000)
2.3999632297286533222315555066336138531249990110581150429351127507313073382394387907799620606605839637313729625072002141189077866868069776118256308436523334093702295212590997172724800581941050486175590336915674697924571040827518114393545078155798612908648318443704816843450757877648767047340310991324194214361783375882627149796293251693220350165818297144369627513858601719453392194229520255386046119776460915758416069834342046510959000919550796144664131206583149333578795817086808273008137070211371244832761278778584547321932764265061366499030089827603080036705660152700132541597081774378052920597565502733544L0
[12]> (golden-angle-rad 10000)
2.3999632297286533222315555066336138531249990110581150429351127507313073382394387907799620606605839637313729625072002141189077866868069776118256308436523334093702295212590997172724800581941050486175590336915674697924571040827518114393545078155798612908648318443704816843450757877648767047340310991324194214361783375882627149796293251693220350165818297144369627513858601719453392194229520255386046119776460915758416069834342046510959000919550796144664131206583149333578795817086808273008137070211371244832761278778584547321932764265061366499030089827603080036705660152700132541597081774378052920597565502733544L0
[13]>
1000 and 10000 recursions give same result
best Rob
Oops , deleted something that shouldn't
Děkuji Maestro,
fixed now
ok, based on the Fermat spiral, the golden angle .. a pine cone model3D
best Rob
the rar file contains an exec with better primitive quality (24)