22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 1 Class 8 - Recursive Pictures r Recursively-defined curves r The Hilbert curve.

Slides:



Advertisements
Similar presentations
Lecture 7 2D Transformation. What is a transformation? Exactly what it says - an operation that transforms or changes a shape (line, shape, drawing etc.)
Advertisements

18/2/00SEM107 - © Kamin & Reddy Class 7 - LineList - 1 Class 7 - Line Drawings  The LineList data type r Recursive methods to construct line drawings.
Shawlands Academy Department Of Technical Education
Rotational Symmetry Students will be able to identify rotational symmetry. Students will be able to predict the results of a rotation and graph rotations.
11.5 Rotations. Rotations Rotate a Figure 90 about the origin.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
REFERENCES: Trigonometry and Applications.
Drill Calculate:.
Recursion: Overview What is Recursion? Reasons to think recursively? An Example How does recursion work?
Seven measuring the world (geo/metry). Measuring space This course is fundamentally about spaces of various kinds Physical space Image space Auditory.
Copyright 2008 by Pearson Education Building Java Programs Chapter 8 Lecture 8-2: Object Methods and Constructors reading: self-checks: #1-12.
Lesson 10-5: Transformations
Approaches To Infinity. Fractals Self Similarity – They appear the same at every scale, no matter how much enlarged.
Applied Mathematics Complex Systems Fractals Fractal by Zhixuan Li.
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
© 2004 Pearson Addison-Wesley. All rights reserved October 27, 2006 Recursion (part 2) ComS 207: Programming I (in Java) Iowa State University, FALL 2006.
Log on and Download from website:
Motion Geometry Part I Geometry Solve Problems Organize Model Compute
POLAR COORDINATES (Ch )
Grade 12 Trigonometry Trig Definitions. Radian Measure Recall, in the trigonometry powerpoint, I said that Rad is Bad. We will finally learn what a Radian.
In Chapter 1, you studied many common geometric shapes and learned ways to describe a shape using its attributes. In this chapter, you will further investigate.
L-Systems and Procedural Plants CSE 3541 Matt Boggus.
Chapter 7 Transformations.
Ch 9 Infinity page 1CSC 367 Fractals (9.2) Self similar curves appear identical at every level of detail often created by recursively drawing lines.
Introduction to the Unit Circle in Trigonometry. What is the Unit Circle? Definition: A unit circle is a circle that has a radius of 1. Typically, especially.
WARM UP 1 1. Graph ΔABC with the vertices A(–3, –2), B(4, 4), C(3, –3) 2. Graph ΔABC with the vertices D(1, 2), E(8, 8), F(7, 1) Compare the two graphs.
10/16/2015IB Math SL1 - Santowski1 Lesson 39 – The Unit Circle IB Math SL1 - Santowski.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
a) y = 3 x b) y = -3 x c) y = (1/2) x d) y = -(1/2) x.
The World’s Largest Ferris Wheel In London, British Airways built a ferris wheel which measures 450 feet in diameter. It turns continuously at a constant.
Main Points: - Python Turtle - Fractals
Scalar Quantities Scalar quantities are measurements that have only magnitude (size) but no direction. Examples of scalar quantities are; Distance Speed.
11-1 Recursive Thinking A recursive definition is one which uses the word or concept being defined in the definition itself When defining an English word,
Precalculus Fifth Edition Mathematics for Calculus James Stewart Lothar Redlin Saleem Watson.
Transformations. Congruent Similar Image vs Pre-image Pre-image: the figure before a transformation is applied. Image: The figure resulting from a transformation.
25/2/00SEM107 - © Kamin & ReddyClass 9 - HTML - 1 Class 9 - HTML r Creating a personal web page r Structure of HTML documents r HTML tags r The APPLET.
2/5/00SEM107 © Kamin & Reddy Review -1 Class 19 - Review r This lecture contains a selection of slides from previous lectures, giving the “high points”
Circles Students will be able to transform an equation of a circle in standard form to center, radius form by using the complete the square method.
17/3/00SEM107 © Kamin & Reddy Class 13 - Animation 1 Class 13 - Animation r Summary of loops m while-do m for m do-while r while loop examples r for loop.
Rotations. Goals Distinguish between a translation, reflection, and rotation. Visualize, and then perform rotations using patty paper. To determine the.
Week 4 Functions and Graphs. Objectives At the end of this session, you will be able to: Define and compute slope of a line. Write the point-slope equation.
 You will be in the group I assign, or not play  You will participate and do every problem for a grade  Your row will rotate who answers each question.
Transformations on the Coordinate Plane Mr. J. Grossman.
Circles equations. Find the missing value to complete the square. 6.x 2 – 2x +7. x 2 + 4x +8. x 2 – 6x + Circles – Warm Up Find the missing value to complete.
Ch 14 Trigonometry!!. Ch 14 Trigonometry!! 14.1 The unit circle Circumference Arc length Central angle In Geometry, our definition of an angle was the.
Unit 10 Transformations. Lesson 10.1 Dilations Lesson 10.1 Objectives Define transformation (G3.1.1) Differentiate between types of transformations (G3.1.2)
Transformations for GCSE Maths Enlargement Translation Reflection Rotation.
11/2/00SEM107 © Kamin & ReddyClass 6 - Lists - 1 Class 6 - Recursion on Lists r More recursive methods on lists.
REFERENCES: Trigonometry and Applications.
8/2/00SEM107- © Kamin and ReddyClass 5 - Lists - 1 Class 5 - Lists r The list data type r Recursive methods on lists.
Dilations A dilation is a transformation that produces an image that is the same shape as the original, but is a different size. A dilation stretches or.
Stage 3: Artist What do you remember from the last class?
Translation Symmetry (Sliding).
Transforms.
Transformations in Geometry
Recursion (part 2) October 26, 2007 ComS 207: Programming I (in Java)
Chapter 5 Curves and Fractals.
Transformations for GCSE Maths
Chapter 11 Recursion.
Transformations for GCSE Maths
Create a design (image) on the graph paper on the last page, making sure at least 3 vertices land on whole number (integer) coordinates, in the upper left.
11 Recursion Software Solutions Lewis & Loftus java 5TH EDITION
Unit 4 Transformations.
Fractals The Hilbert Curve.
Transformations for GCSE Maths
Recursion (part 2) March 22, 2006 ComS 207: Programming I (in Java)
A rotation has to have three elements…
Java Software Solutions Foundations of Program Design Sixth Edition
A rotation has to have three elements…
Rotation Around a Point
Presentation transcript:

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 1 Class 8 - Recursive Pictures r Recursively-defined curves r The Hilbert curve

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 2 Recursive drawings r Many shapes are “self-similar” - their overall structure is repeated in sub-pictures. r Peano curve:

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 3 Recursive drawings (cont.) “Koch snowflake”:

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 4 Recursive drawings (cont.)

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 5 The Hilbert Curve r Created by David Hilbert ( ), this is a “space-filling” curve. r Hilbert curve of order n is constructed from four copies of the Hilbert curve of order n-1, properly oriented and connected.

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 6 Hilbert curves of order 1 & 2 HC(1): HC(2):

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 7 Hilbert curve of order 3 HC(3):

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 8 Hilbert curve of order 4

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 9 Hilbert curve of order 5

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 10 The Hilbert Curve Pattern Hilbert curves have “open” side on left: Form H.C. of order n by combining four copies of H.C. of order n-1, plus three connecting lines (of length sl): n-1

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 11 Recursive definition of H.C. This leads to the basic recursive pattern for defining HC(order, sl): int diam = size of HC of order n-1; hcsub1 = HC(order-1, sl); hcul = rotate hcsub1 by -90 degrees; hcur = translate hcsub1 to (diam+sl, 0); hclr = translate hcsub1 to (diam+sl, diam+sl); hcll = rotate hcsub1 by 90 degrees, then translate to (0, diam+sl); hc = append(hcul, append(hcur, append(hclr, hcll))); return hc, with three lines added;

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 12 Translation We have already seen how to translate a LineList: static LineList translate (LineList L, int x, int y) { if (L.empty()) return L; else { Line ln = L.hd(); Line transLine = new Line(ln.x0()+x, ln.y0()+y, ln.x1()+x, ln.y1()+y); return LL.cons(transLine, translate(L.tl(), x, y)); }

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 13 Rotation Rotation is more complicated. Consider rotating one point around the origin by angle  : 1. Calculate m and  m =  x 2 +y 2  = tan -1 (y/x) 2.  =  +  3. (x’,y’) = point of length m, at angle  (x,y) (x’,y’)   

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 14 Rotation (cont.) We’ll rotate shapes (i.e. LineList’s) about the origin by rotating each line: static LineList rotateShapeAboutOrigin (LineList L, double theta) { if (L.empty()) return LL.nil; else return LL.cons(rotateLine(L.hd(), theta), rotateShapeAboutOrigin(L.tl(), theta)); }

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 15 Rotation (cont.) Rotating individual lines around the origin is a matter of rotating both endpoints, as we have indicated. Some added complexity comes from two factors:  Math.atan returns angles in the range -  /2 to  /2 (i.e. only angles in the right half-plane) m The graphics coordinate system is “upside- down” relative to ordinary Cartesian coordinates.

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 16 Rotation (cont.) static Line rotateLine (Line ln, double theta) { int x0 = ln.x0(), y0 = -ln.y0(), // turn coordinates rightside-up x1 = ln.x1(), y1 = -ln.y1(); // turn coordinates rightside-up double currangle0 = Math.atan((double)y0/x0); double newangle0 = currangle0+theta; if (x0<0) newangle0 = newangle0 + Math.PI; double mag0 = Math.sqrt(x0*x0+y0*y0); int newx0 = (int)Math.round(mag0*Math.cos(newangle0)); int newy0 = -(int)Math.round(mag0*Math.sin(newangle0));

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 17 Rotation (cont.) double currangle1 = Math.atan((double)y1/x1); double newangle1 = currangle1+theta; if (x1<0) newangle1 = newangle1 + Math.PI; double mag1 = Math.sqrt(x1*x1+y1*y1); int newx1 = (int)Math.round(mag1*Math.cos(newangle1)); int newy1 = -(int)Math.round(mag1*Math.sin(newangle1)); return new Line(newx0,newy0,newx1,newy1); }

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 18 Rotation (cont.) One remaining technicality: when we say “rotate a shape”, we usually mean, “rotate it around its center”. However, so far we know only how to rotate a shape around the origin. The rotateShape method takes a shape and an angle and a point (x,y) which is taken to be the center of the shape.

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 19 Rotation (cont.) static LineList rotateShape (LineList L, double theta, int x, int y) { LineList transL = translate(L, -x, -y); LineList rotateL = rotateShapeAboutOrigin(transL, theta); return translate(rotateL, x, y); } It does so by translating the shape, then rotating, then translating back:

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 20 The Hilbert Curve int diam = size of HC of order n-1; hcsub1 = HC(order-1, sl); hcul = rotate hcsub1 by -90 degrees; hcur = translate hcsub1 to (diam+sl, 0); hclr = translate hcsub1 to (diam+sl, diam+sl); hcll = rotate hcsub1 by 90 degrees, then translate to (0, diam+sl); hc = append(hcul, append(hcur, append(hclr, hcll))); return hc, with three lines added; Recall again the abstract version of HC(order, sl):

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 21 Hilbert Curve (cont.) We can now say that the rotation steps should rotate the shape around the center of the Hilbert curve of order n-1. That center is at ( diam /2, diam /2). How do we calculate diam ? A review of the Hilbert curve of various orders show that HC(n-1) has diameter ( 2 n-1 -1)*sl. This leads to our solution:

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 22 The HC Method static LineList HC (int order, int sl) { if (order == 1) return LL.cons(new Line(0,0,sl,0), LL.cons(new Line(sl,0,sl,sl), LL.cons(new Line(sl,sl,0,sl), LL.nil))); else { int diam = sl*(int)(Math.pow(2,order-1)-1); // diameter of HC(order-1) int radius = diam/2; LineList hcsub1 = HC(order-1, sl);

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 23 The HC Method (cont.) LineList hcul = rotateShape(hcsub1, -Math.PI/2, radius, radius); LineList hcur = translate(hcsub1, diam+sl, 0); LineList hclr = translate(hcsub1, diam+sl, diam+sl); LineList hcll = translate( rotateShape(hcsub1,Math.PI/2, radius, radius), 0, diam+sl); LineList hc = append(hcul, append(hcur, append(hclr, hcll)));

22/2/00 SEM107 © Kamin & Reddy Class 8 - Hilbert’s curve - 24 The HC Method (cont.) hc = LL.cons(new Line(diam,0,diam+sl,0), LL.cons(new Line(diam+sl,diam,diam+sl,diam+sl), LL.cons(new Line(diam+sl,2*diam+sl, diam,2*diam+sl), hc))); return hc; }