Fractals/Iterations in the complex plane/Mandelbrot set/lavaurs

< Fractals < Iterations in the complex plane < Mandelbrot set
Lavaurs Algorithm
Lamination of Mandelbrot set up to period 12

This algorithm shows :

External angles (measured in turns modulo 1) landing on root points of period p components of Mandelbrot set are:

Arc (chord) consists of:

Names

Mathematical description

Programmer's description

Computing pair of angles

(to do )


Drawing arcs connecting angles

Converting units of angles

First units are in turns ( list of pairs of angles )

Using ttr function:

(defun ttr (turn)           
" Turns to Radians"
(* turn  (* 2 pi) ))

convert them to radians:

(alpha (ttr ( first angle-list)))

Computing points of intersection

Main circle (x0,y0,r0) and new orthogonal circle ( x,y,r) have 2 common points :

(ca (cos alpha))
(sa (sin alpha))
; first common point 
(a (+ x0 (* r0 ca))) ; a = x0 + r0 * cos(alpha)
(b (+ y0 (* r0 sa))) ; b = y0 + r0 * sin(alpha)

Computing orthogonal circle

Radius and center

At points of intersection radius r0 and new radius or orthogonal circle are also orthogonal. Center of new circle ( x,y) is on the line through point (x0,y0) and slope defined by angle gamma :

gamma = alpha + (balpha - alpha)/2

(gamma (+ alpha (/ (- balpha alpha) 2))) ; angle between alpha and balpha

Using this information one can compute new circle : (x,y,r)

new angles

One has:

Because arc will be drawn using new circle one has to compute (convert) new angles ( angles measured in new circle) :

angle of point c1 = (a,b) measured in new circle units.

 (phi  (atan r0 r))) ; phi = (new-alpha - new-balpha)
 (balha (+ pi gamma phi))  ; new balpha 
 (alpha (- (+ pi gamma) phi)) ; new alpha

Drawing arc

It depends of available procedures.

From point to point

Easiest case is drawing arc from point c1 to c2.


Postscript

In postscript there is arct procedure : [7]

x1 y1 x2 y2 r arct 

So in Lisp one can directly create ps file and use this procedure :

; code by Copyright 2009 Rubén Berenguel
; http://www.mostlymaths.net/2009/08/lavaurs-algorithm.html
(defun DrawArc (alpha balpha R)
  "Generate the postscript arcs using arct 
   x1 y1 x2 y2 r arct "
  (format t "newpath ~A ~A moveto 300 300 ~A ~A ~A arct" 
	  (+ 300 (* 100 (cos balpha))) 
	  (+ 300 (* 100 (sin balpha)))
	  (+ 300 (* 100 (cos alpha))) 
	  (+ 300 (* 100 (sin alpha)))
	  R))
SVG

In SVG there is the elliptical arc curve command.[8] [9][10][11][12][13]

It is a version of path command that draws an elliptical arc from the current point to (x, y).

The size and orientation of the ellipse are defined by two radii (rx, ry) and an x-axis-rotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system.

The center (cx, cy) of the ellipse is calculated automatically to satisfy the constraints imposed by the other parameters.

large-arc-flag and sweep-flag contribute to the automatic calculations and help determine how the arc is drawn.

rx ry x-axis-rotation large-arc-flag sweep-flag x y
<path d="M 100,100 a100,100 0 0,0 100,50" fill="none" stroke="red" stroke-width="6" />


<?xml version="1.0" standalone="no"?>
<svg width="800px" height="800px" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <path d="M100 100
           A 100 100 0 0 0 162.55 162.45
           " stroke="black" fill="none" stroke-width="2" fill-opacity="0.5"/>
</svg>


SVG path elements :

So one can draw arc by writing path command to svg file like that :

(format stream-name "<path d=\"M~,0f ~,0f A~,0f ~,0f 0 0 0 ~,0f ~,0f\"  />~%" 
	(first arc-list)
	(second arc-list)
	(third arc-list)
	(third arc-list)
	(fourth arc-list)  ; 
 	(fifth arc-list))


Remember that initial coordinate system in SVG has the origin at the top/left with the x-axis pointing to the right and the y-axis pointing down. [14] For drawing all arcs it may be not important, but labels with angels will be wrong.

From angle to angle

This case is harder, because one must convert angles from main circle to new, orthogonal circle. When angles are converted then :

In Vecto Common Lisp package there is arcn procedure [15]

(vecto:move-to ( sixth arc-list) (seventh arc-list)) ; beginning of arc is point (a,b)
(vecto:arcn
	( first arc-list)  ; x
	(second arc-list)  ; y
	(third arc-list)   ; radius
	(fourth arc-list)  ; angle1
 	(fifth arc-list))) ; angle2

 (vecto:stroke)

Examples of code

References

  1. [Freddie Exall : An Introduction to Equivalant Matings]
  2. A. DOUADY, Algorithms for computing angles in the Mandelbrot set (Chaotic Dynamics and Fractals, ed. Barnsley and Demko, Acad. Press, 1986, pp. 155-168).
  3. Lavaurs, P., "Une description combinatoire de l'involution define par M sur les rationnels a denominateur impair," C. R. Acad. Sci. Paris 303 (1986), 143-146.
  4. Combinatorics in the Mandelbrot Set - Lavaurs Algorithm by Michael Frame, Benoit Mandelbrot, and Nial Neger
  5. Constructing orthogonal circle from Fractal Geometry at Yale University by Michael Frame, Benoit Mandelbrot (1924-2010), and Nial Neger. Version : November 7, 2010
  6. Orthogonal Circle at planetmath.org
  7. Postscript Operators at Joint Stock Company
  8. SVG documentation : The elliptical arc curve commands
  9. svg basics description of arcs
  10. Elliptical arc implementation notes
  11. Paths at mozilla developer center
  12. arc at Pilat Informative Educative
  13. oreilly documentation
  14. The initial coordinate system - SVG documentation at w3.org
  15. arcn procedure from Vecto Common Lisp package by Zach Beane.
  16. lavaurs algorithm by Ruben Berenguel

See also

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.