## Bay Area Mathematical Artists, III

Another successful meeting of the Bay Area Mathematical Artists took place yesterday at the University of San Francisco!  It was our largest group yet — seventeen participants, include three new faces.  We’re gathering momentum….

Like last time, we began with a social half hour from 3:00–3:30.  This gave people plenty of time to make their way to campus.  I didn’t have the pleasure of participating, since the campus buildings require a card swipe on the weekends; I waited by the front door to let people in.  But I did get to chat with everyone as they arrived.

We had a full agenda — four presenters took us right up to 5:00.  The first speaker was Frank A. Farris of Santa Clara University, who gave a talk entitled Fibonacci Wallpaper Spirals.

He took inspiration from John Edmark’s talk on spirals at Bridges 2017 in Waterloo, which I wrote about in my blog last August (click here to read more).  But Frank’s approach is rather different, since he works with functions in the complex plane.

He didn’t dive deeply into the mathematics in his talk, but he did want to let us know that he worked with students at Bowdoin College to create open-source software which will allow anyone to create amazing wallpaper patterns.  You can download the software here.

Where do the Fibonacci numbers come in?  Frank used the usual definition for the Fibonacci numbers, but used initial values which involved complex numbers instead of integers.  This allowed him to create some unusually striking images.  For more details, feel free to contact him at ffarris@scu.edu.

Next was our first student talk of the series, My Experience of Learning Math & Digital Art, given by Sepid Ebrahimi.  Sepid is a student in my Mathematics and Digital Art course; she is a computer science major and is really enjoying learning to code in Processing.
First, Sepid mentioned wanting to incorporate elements into her work beyond simple points, circles, and rectangles.  Her first project was to recreate an image of Rick and Morty, the two main characters in the eponymous cartoon series.  She talked about moving from simple blocks to bezier curves in order to create smooth outlines.
Sepid then discussed her second project, which she is using for her Final Project in Mathematics and Digital Art.  In order to incorporate sound into her work, she learned to program in Java to take advantage of already-existing libraries.  She is creating a “live audio” program which takes sound input in real time, and based on the frequencies of the sound, changes the features of various geometrical objects in the video.  Her demo was very fascinating, and all the more remarkable since she just started learning Processing a few months ago.  For more information, you can contact Sepid at sepiiid.ebra@gmail.com.
The third talk, Conics from Polygons: the Chord Ratio Construction, was given by Scott Vorthmann.  He is spreading the word about vZome, an open-source virtual environment where you can play with Zometools.
The basis of Scott’s talk was a simple chord ratio construction, which he is working on with David Hall.  (Here is the GeoGebra worksheet if you would like to play with it.)  The essential idea is illustrated below.
Begin with two segments, the red and green ones along the coordinate axes.  Choose a ratio r.  Now add a chord parallel to the second segment and r times as long — this gives the thick green segment at y = 1.  Connect the dots to create the third segment, the thin green segment sloping up to the right at x = 1.  Now iterate — take the second and third segments, draw a chord parallel to the second segment and r times as long (which is not shown in the figure), and connect the dots to form the fourth segment (the thin green segment sloping to the left).
Scott then proceeded to show us how this very simple construction, when iterated over and over with multiple starting segments, can produce some remarkable images.
Even though this is created using a two-dimensional algorithm, it really does look three-dimensional!  Conic sections play a fundamental role in the geometry of the points generated at various iterations.  Quadric surfaces in three dimensions also come into play as the two-dimensional images look like projections of quadric surfaces on the plane.  Here is the GeoGebra worksheet which produced the graphic above.  For more information, you can contact Scott at scott@vorthmann.org.
The final presenter was Stacy Speyer, who is currently an artist-in-residence at Planet Labs.  (Click here to read more about art at Planet Labs.)  She didn’t give a slideshow presentation, but rather brought with her several models she was working on as examples of Infinite Polyhedra Experiments with Planet’s Satellite Imagery.
One ongoing project at Planet Labs is planetary imaging.  So Stacy is taking high-resolution topographical images and using them to create nets for polyhedra.  She is particularly interested in “infinite polyhedra” (just google it!).  As you can see in the image above, six squares meet at each vertex, and the polyhedron can be extended arbitrarily far in all directions.
One interesting feature of infinite polyhedra (as you will notice above) is that since you cannot actually create the entire polyhedron, you’ve got to stop somewhere.  This means that you can actually see both sides of all the faces in this particular model.  This adds a further dimension to artistic creativity.  Feel free to contact Stacy at cubesandthings@gmail.com for more information!
We’ll have one more meeting this year.  I am excited to see that we’re making so much progress in relatively little time.  Presentations next time will include talks being prepared for the Joint Mathematics Meetings in San Diego this coming January, so stay tuned!

## Bridges 2017 in Waterloo, Canada!

Bridges 2017 was in full swing last weekend, so now it’s time to share some of the highlights of the conference.  Seems like they keep getting better each year!

The artwork was, as usual, quite spectacular.  I’ll share a few favorites here, but you can go to the Bridges 2017 Gallery to see all the pieces in the exhibitions, along with descriptions by the artists.

My favorite painting was Prime numbers and cylinders by Stephen Campbell.

What is even more amazing than the piece itself is that Stephen makes his own paint!  So each piece involves an incredible amount of work – and the results are worth it.  Visit Stephen’s website to see more of his work and learn a bit more about his artistic process.

I also liked these open tilings of space by Frank Gould.

Although they are simple in design, the overall effect is quite appealing.  I often find that the fewer elements in a piece, the more difficult it is to coax them into interacting in a meaningful way.  It is challenging to be a minimalist.

This lantern, Variations on Colourwave 17 — Mod 2, designed by Eva Knoll, shows a pattern created using modular arithmetic.

The plenary talks this year were almost certainly the best I have ever experienced at any conference.  Opening the conference was a talk by Damian Kulash of the band OK Go.  He described his creative process and gave some insight to how he makes his unbelievable videos.

They really cannot be described in words – one example he talked about was this video filmed in zero gravity in an airplane!  There are no tricks here — just unbridled creativity and cleverness.

Another favorite was the talk by John Edmark.  Many of his ideas had a spiral theme, like the piece you see below.

But what is fascinating about his work is how it moves.  When this structure is folded inward, it actually stretches out.  This is difficult to describe in words, but you can see a video of this phenomenon on John’s website.  What made his talk really interesting is that he discussed the mathematics behind the design of his work.

Stephen Orlando talked about his motion exposure photography.

Although seemingly impossible, this image is just one long-exposure photograph — the colors you see were not added later.  Stephen’s technique is to put programmable LED lights on a paddle and photograph a kayaker paddling across the water.

But where is the kayaker?  Notice the background — it’s almost dark.  It turns out that if the kayaker moves at a fast enough rate, the darkness does not allow enough time for an image of the kayaker to be captured.  Simply amazing.  Visit Stephen’s website for more examples of his motion exposure photographs.

There were also many other interesting talks given by Bridges participants, but there is not enough room to talk about them all.  You can always go to the Bridges 2017 website and download any of the papers you’re interested in reading.

But Bridges is also more than just art and talks.  Bridges participants are truly a community of like-minded people, so social and cultural events are also an important aspect of any Bridges conference.

I shared an AirBnB with Nick and his parents a short walk from campus — the house was spacious and comfortable, and really enhanced the Bridges experience.  Sandy (Nick’s mother) wanted to host a gathering, so I invited several friends and colleagues over the Friday night of the conference for an informal get-together.

It was truly an inspiring evening!  There were about fifteen of us, mostly from around the Bay area.  Everyone was talking about mathematics and art — we were so engrossed, it turns out that no one even remembered to take any pictures!  One recurring topic of discussion was the possibility of having some informal gatherings throughout the year where we could share our current thoughts and ideas.  I think it may be possible to use space at the University of San Francisco — I’ve already begun looking into it.

Lunch each day was always from 12:00–2:00, so there was never any need to rush back.  This left plenty of time for conversation, and often allowed time to admire the art exhibitions.  It seems that you always noticed something new every time you walked through the displays.

On Saturday evening of the conference was a choir concert featuring a cappella voices singing a wide range of pieces spanning from the 15th century to the present day.  It was a very enjoyable performance; you can read more about it here.

The evening of Sunday, July 30th, was the last evening of the conference for us.  Many participants were going to Niagara Falls the next day, but we were all flying out on Monday.  We decided to find a group and go out for dinner — and about a dozen of us ended up at a wonderful place for pizza called Famoso.

We chatted for quite some time, and then split up — some wanted to attend an informal music night/talent show on campus, but others (including me and the Mendlers) went to shoot some pool at a local pool hall.  Again, a good time was had by all.

While the first day of the conference seemed a little slow, the rest just flew by.  Another successful Bridges conference!  Nick and I both had artwork exhibited and gave talks, caught up with friends and colleagues from all around the globe, enjoyed many good meals, and got our fill of mathematical art.

Although the location for the next Bridges conference is usually announced at the end of the last plenary talk, these is still some uncertainty about who will be hosting the conference next year.  But regardless of where it is, you can expect that Nick and I will certainly be there!

## 100 Posts!

Can you believe it?  I have been waiting to be able to finally tag “Day1xx”, and that day is finally here!

I could say something momentous on this occasion.  But I’m not sure that’s really necessary — you can imagine that keeping a blog running for 100 weeks with (hopefully!) interesting posts on mathematics, creativity, and art is momentous emough.

But I have been running into a problem:  my blog is getting harder to search.  For example, I just got five pages of results by searching for “fractal”!  So I thought I’d put together an index of all my blog posts, organized by category.

I hope this is of use to newer followers — you might like certain topics better than others, and this way you can easily look at older posts related to the ones you like.

The category a post is listed under is what I consider its primary category — but rarely does a single post only address on topic.  But surely this index is a step in the right direction.

And lastly, I would like to thank all my followers for encouraging to keep me going.  I get an email every time someone likes or comments — and I appreciate each one. Thanks again!

A.  Introduction

1. Day001, What Is Mathematics?

B.  Mathematical and Digital Art

1. Day002, Josef Albers and Interaction of Color.
2. Day011, Evaporation I.
3. Day012, Evaporation II.
4. Day015, Geometrical Dissections II: Four to One.
5. Day022, Envelopes III:  Art and Randomness
6. Day029, The Joy of Ink I.
7. Day030, The Joy of Ink II.
8. Day054, Color I: Opacity and Josef Albers.
9. Day055, Color II: Opacity and Josef Albers.

C.  Mathematical Puzzles

1. Day003, CrossNumber Puzzles.
2. Day005, Cryptarithms.
3. Day010, ColorSlide Puzzles.
4. Day018, Roman Numeral Puzzles.
5. Day024, Logic Puzzles I.
6. Day025, Logic Puzzles II.
7. Day031, Number Searches I.
8. Day032, Number Searches II.
9. Day109, Beguiling Games I:  Nic-Nac-No.
10. Day114, Beguiling Games II:  Nuh-Uh!

D.  Two-Dimensional Geometry

1. Day004, Hexominoes and Cube Nets.
2. Day014, Geometrical Dissections I.
3. Day020, Envelopes I.
4. Day021, Envelopes II:  Making Spirals.
5. Day074, The Ravioli Equation.
6. Day106, Polygons.

E.  Pedagogy

1. Day006, The Problem with Calculus Textbooks.
2. Day013, Writing Original Problems.
3. Day023Day093 (reprise), The Problem with Grades.
4. Day026, On Grading.
5. Day028, International Dodecahedron Day 2016!

F.  Koch Curves and Related Topics

1. Day007, Creating Fractals.
2. Day008, Creating Fractals II: Recursion vs. Iteration.
3. Day009, Creating Fractals III: Making Your Own.
4. Day027, Creating Fractals IV:  Results!
5. Day033, New Koch Snowflakes.
6. Day062, Koch Curves and Canopies.
7. Day065, p-adic Numbers I: When Big is Small.
8. Day067, p-adic Numbers II: When Big is Small.

G.  Essays

1. Day016, On Mathematical Creativity I.
2. Day017, On Mathematical Creativity II.
3. Day019, Writing a Math Blog.

H.  Iterated Function Systems

1. Day034, Creating Fractals V:  Iterated Function Systems I.
2. Day035, Creating Fractals VI:  Iterated Function Systems II.
3. Day036, Creating Fractals VII:  Iterated Function Systems III.

I.  Programming and Coding

1. Day037, Creating Fractals VIII:  PostScript Programming.
2. Day058, On Coding I.
3. Day060, On Coding II: LISP.
4. Day064, On Coding III: LISP to Mathematica.
5. Day068, On Coding IV: Mathematica.
6. Day075, On Coding V: Postscript.
7. Day078, On Coding VI: HTML.
8. Day082, On Coding VII: LaTeX I.
9. Day085, On Coding VIII: LaTeX II.
10. Day092, On Coding IX: Computer Graphics I.
11. Day099, On Coding X: Computer Graphics II.
12. Day107, On Coding XI: Computer Graphics III, POV-Ray.

J.  Mathematics and Art Conferences

1. Day038, Bridges:  Mathematics and Art I.
2. Day049, Bridges:  Mathematics and Art II.
3. Day050, Vienna!  (Symmetry Conference 2016).
4. Day053, Bridges: Mathematics and Art III. Jyvaskyla, Finland!
5. Day083, Art Exhibition: Golden Section 2017.
6. Day105, Bridges 2017 in Waterloo, Canada!

K.  Processing

1. Day039, Making Movies with Processing I.
2. Day040, Making Movies with Processing II.
3. Day041, Making Movies with Processing III.
4. Day042, Making Movies with Processing IV.
5. Day043, Making Movies with Processing V.
6. Day044, Making Movies with Processing VI.
7. Day108, To Processing I.
8. Day110, Using Processing for the First Time.
9. Day113, Creating Animated GIFs in Processing.

L.  Mathematics and Digital Art Course

1. Day045, Mathematics and Digital Art I.
2. Day046, Mathematics and Digital Art II.
3. Day047, Mathematics and Digital Art III.
4. Day048, Mathematics and Digital Art IV.
5. Day057, Digital Art I: End of Week 2 (Fall 2016).
6. Day059, Digital Art II: End of Week 4 (Fall 2016).
7. Day061, Digital Art III: End of Week 6 (Fall 2016).
8. Day063, Digital Art IV: End of Week 8 (Fall 2016).
9. Day066, Digital Art V: End of Week 11 (Fall 2016).
10. Day069, Digital Art VI: End of Week 14 (Fall 2016).
11. Day071, Digital Art VII: Final Projects! (Fall 2016).
12. Day072, Digital Art VIII: The End (Fall 2016).
13. Day081, Mathematics and Digital Art: Update 1 (Spring 2017).
14. Day086, Mathematics and Digital Art: Update 2 (Spring 2017).
15. Day090, Mathematics and Digital Art: Update 3 (Spring 2017).
16. Day094, Mathematics and Digital Art: Final Update (Spring 2017).
17. Day112, Mathematics and Digital Art: Update 1 (Fall 2017).

M.  Guest Bloggers

1. Day051, Guest Blogger:  Geoffrey Owen Miller, I.
2. Day052, Guest Blogger:  Geoffrey Owen Miller, II.
3. Day096, Guest Blogger: Percival Q. Plumtwiddle, I.
4. Day097, Guest Blogger: Percival Q. Plumtwiddle, II.

N.  Milestones

1. Day056, Celebrating One Year!

O.  Imagifractalous!

1. Day070, Imagifractalous! 1: How it all began.
2. Day073, Imagifractalous! 2: p-adic sequences.
3. Day077, Imagifractalous! 3: Fractal Binary Trees.
4. Day087, Imagifractalous! 4: Fractal Binary Trees II.
5. Day088, Imagifractalous! 5: Fractal Binary Trees III.
6. Day089, Imagifractalous! 6: Imagifractalous!
7. Day103, Imagifractalous! 7: Fractal Binary Trees IV.

P.  What is a Geometry?

1. Day076, What is a Geometry?
2. Day079, What is…Taxicab Geometry?
3. Day084, What is…Spherical Geometry?
4. Day091, What is…Inversive Geometry?
5. Day095, More on: What is…Inversive Geometry?
6. Day101, What is…Projective Geometry?
7. Day102, More on:  What is…Projective Geometry?
8. Day104, Still more on:  What is…Inversive Geometry?

Q.  Miscellaneous Mathematics

1. Day080, A New Cantor Set?
2. Day098, The One Four Conjecture.

R.  Bay Area Mathematical Artists

1. Day 111, Bay Area Mathematical Artists, I.

## Celebrating One Year!

It’s hard to believe, but I published my first blog post one year ago today on September 1, 2015.  It’s been a challenge at times to keep up the weekly posts — but I’m very glad I did.  So here I write, fifty-five posts later….

I do wish to thank my followers and email subscribers, but I’ll stop there at sentimentality.  Given the occasion, I thought I’d talk about one important aspect of the art of mathematics that I’ve hinted at now and then.  Mathematics is a team effort.

Sure, sometimes I have to sit at my desk and just do mathematics.  But there’s a lot more to mathematical endeavor than that.  So I’d like to discuss some conversations I’ve had over the past year — conversations which helped me formulate new ideas and forge new directions to pursue.  Places I wouldn’t have gone if all I did was sit at my desk….

Some of my earlier posts were a direct result of doing some independent study work with one of my students, Thomas.

We were talking about the usual recursive algorithm to create the Koch snowflake, and he asked what would happen if we changed the angles used in the algorithm.  This prompted a year-long investigation into properties of images created using the algorithm — especially images with rotational symmetry.

I gave talks about this phenomenon in Vienna and Finland.  I also mentioned discussing this with one of the conference attendees in Vienna — Paul — who said the images in my talk reminded him of some work he had done earlier.  This image is generated using Paul’s algorithm.

When I looked at his paper, I found that he had used a different recursive algorithm — but surprisingly, the images had a similar feel to those I created.  I haven’t had time to explore this alternate algorithm yet, but if I hadn’t been talking to another artist and mathematician, I might never have come across it.

My last two posts were the direct result of attending a talk at the Bridges conference in Finland.  I had posted about Josef Albers before, but James gave a talk which looked at Albers’ Homage to the Square series in an entirely different way.

The ideas in this talk got me thinking about color on a computer screen and the use of opacity — how there are many different ways to color objects using various combinations of color values and opacity such that visually, they appear the same on a computer screen.

By looking at how opacity is implemented in a typical graphics program, this phenomenon may be analyzed mathematically.  I’ve just scratched the surface in the last two posts; there’s definitely more to be done here.

Working with Nick to get prepared for the Bridges conference was also valuable.  He created fractal images using a particular recursive algorithm he developed.

Most recently, Nick generated a series of fractal images based on a certain parameter.  When this parameter is below some threshold value, the image looks like fractal dust.  Above this threshold value, and the image overlaps itself.  But there seems to be a particular value where parts of the fractal just touch.

Sometimes finding such threshold values can be very difficult.  But I have a hunch we might be able to calculate it for some of the simpler fractals, and I look forward to the challenge.

There were many, many other conversations about mathematics and art over the past year — but these jump out to me as significant.

Any mathematician reading will naturally say, “Of course!”  This is the way that most mathematicians I know work on a daily basis.  It is often useful to share work with others and bounce your ideas off them, just like in most other disciplines.

I think it less likely that a non-mathetician would see the social aspect of doing mathematics.  So I thought I’d talk about that today.

A final “Thank you!” to my loyal followers.  I’ll keep talking, traveling, creating art, and introducing you to others who have inspired me along the way.  Time to begin Year Two!

## Vienna!

Last week, I attended the Symmetry Festival 2016  in Vienna!  I’d like to share some highlights of the week.

The first was a sculpture based on a hypercube net.  One of the most famous illustrations of this geometrical object is Dali’s Crucifixion.

Without going into too many details, eight cubes may be folded into a four-dimensional cube — called a hypercube or tesseract — just as a net of six squares may be folded into a cube.  Because folding a flat net of six squares requires folding into the third dimension, folding a hypercube net requires a fourth spatial dimension.

Analogously, just as the squares are not distorted as they are folded into the third dimension, the cubes are not distorted when folded into the fourth dimension.  A little mind-blowing, but true.

Silas Drewchin created the following sculpture based on the hypercube net.

You’ll notice a few differences:  there is an extra cube added, for a total of nine cubes.  And there are three additional struts added to support the net being tilted at an angle.  Here is what he says about those design elements:

The Hypercross is a metaphor of acceptance….By giving the Hypercross an extra base cube, the mathematical purity of the net tesseract is shattered because a true tesseract only has two base cubes. To disfigure the purity of Christian symbolism embedded in the tesseract, it is tilted to an acute angle as if it is tumbling to the ground. Without this tilted adaptation the sculpture would look dogmatic. The hybrid distortions of the mathematical form and religious form actually add to the message of acceptance.

An additional feature of this work relates to the shadows it casts.  The photo speaks for itself.

A fascinating piece!  I’m a big fan of the fourth dimension, and always appreciate when it arises in mathematical and artistic contexts.

The second highlight for me was meeting someone who is interested in creating the same type of digital images I do.  I had met Paul Gailiunas before at previous conferences, but never knew of his interest.  Here is an adaptation of one of his images — you’ll notice a similarity to those I recently posted on Twitter (@cre8math, 2016 July).

What was facscinating to me was how he created images like these.  I first discussed these images on Day007, where I used the same recursive algorithm typically used to create a Koch snowflake:

F  +60  F  +240  F  +60  F.

But Paul used a different recursive algorithm, which I’ll briefly describe — it definitely has a similar flavor, but there are important differences.  Define a function R so that R(1) means move forward and make a turn of some specified angle a, and R(2) means move forward and make a turn of some angle b.  Then recursively define

R(n) = R(n – 1) R(n – 2).

For example, choosing n = 3 gives the two segments produced by

R(3) = R(2) R(1).

But to obtain R(4), we need to use recursion:

R(4) = R(3) R(2) = R(2) R(1) R(2).

This recursive process may be repeated indefinitely.

This algorithm, like the one used to generate the Koch curve, sometimes closes up and exhibits rotational symmetry.  One challenge in this case is that the center of symmetry is not the origin of the coordinate system!  A rigorous mathematical proof of which choices of angles a and b generate a closed, symmetric curve is still forthcoming….

A third highlight was the Family Day activities in front of the Karlskirche in the Karlsplatz.  At conferences like these (such as the upcoming Bridges conference in Finland), there is a day where mathematics and art activities take place in a public venue, and anyone walking by can sit down and participate.

I sat down at the table demonstrating the Poly-Universe, a system of geometrical forms created by Janos Saxon-Szasz.  They were fun to play with, and rather challenging as well!

I was happy to have solved the puzzle illustrated here — put together all 24 tiles to make a system of hexagons so that the colors and shapes all match.  There are many solutions, but none are easy to find.

What makes these forms interesting is that each tile includes four colors and parts of four differently sized circles.  Moreover, they occur in all possible combinations — and since there are 4 sizes of circles, there are 4! = 24 possible configurations.

There are also forms made from triangles and squares, which pose a different challenge.  I moved to help a young girl and her mother try to put together a 6 x 4 rectangle from the 24 square pieces, but was not so successful there.  At some point you have to move on to see the other exhibits….

A final highlight was the Natural History museum in central Vienna.  They had an extensive array of minerals and gems — the largest collection I’ve ever seen.  The colors and textures were diverse and beautiful, and of course when looking at crystal structures, there’s a lot of geometry.

Because the rhombic dodecahedron is space-filling, it tends to occur as the basis for crystal structures, as shown here.

It is always remarkable to me how nature is constrained by geometry — or maybe geometry is derived from nature?  Regardless of how you look at it, the interaction of geometry and nature is fascinating.

The week went by pretty quickly, as they usually do when attending conferences like these. Stay tuned for further updates on my European adventure!  (I’m also tweeting daily at @cre8math.)

## Making Movies with Processing IV

Last week, we saw how using linear interpolation allowed us to create animations of fractals.  This week, we’ll explore how to create another special effect by using linear interpolation in a different way.  We’ll build on last week’s example, so you might want to take a minute to review it if you’ve forgotten the details.

Let’s suppose that in addition to morphing the Sierpinski triangle, we want to slowly rotate it as well.  So we insert a rotate command before plotting the points of the Sierpinski triangle, as shown here:

First, it’s important to note that the rotate command takes angles in radian measure, not degrees.  Recall from your trigonometry classes that

$360^\circ=2\pi{\rm \ radians.}$

But different from your trigonometry classes is that the rotation is in a clockwise direction.  When you studied the unit circle, angles moved counter-clockwise around the origin as they increased in measure.  This is not a really complicated difference, but it illustrates again how not every platform is the same.  I googled “rotating in processing” to understand more, and I found what I needed right away.

Let’s recall that p is a parameter which is 0 at the beginning of the animation, and 1 at the end.  So when p = 0, there is a rotation of 0 radians (that is, no rotation), and when p = 1, there is a rotation of $2\pi$ radians, or one complete revolution.  And because we’re using linear interpolation, the rotation changes gradually and linearly as the parameter p varies from 0 to 1.

Let’s see what effect adding this line has.  (Note:  Watch the movie until the end.  You’ll see some blank space in the middle — we’ll explain that later!)

What just happened?  Most platforms which have a rotate command assume that the rotation is about the origin, (0,0).  We learned in the first post that the origin in Processing is in the upper left corner of the screen.  If you watch that last video again, you can clearly see that the Sierpinksi triangle does in fact rotate about the upper left corner of the screen in a clockwise direction.

Of course this isn’t what we want — since most of the time the fractals are out of the view screen!  So we should pick a different point to rotate around.  You can pick any point you like, but I though it looked good to rotate about the midpoint of the hypotenuse of the Sierpinski triangles.  When I did this, I produced the following video.

So how did I do this?  It’s not too complicated, but let’s take it one step at a time.  We’ve got to remember that before scaling, the fractal fit inside a triangle with vertices (0,0), (0,2), and (2,0).  I wanted to make it 450 pixels wide, so I scaled by a factor of 225.

This means that the scaled Sierpinski triangle fits inside a right triangle with vertices (0, 0), (0, 450), and (450, 0).  Using the usual formula, we see that the midpoint of the hypotenuse of this triangle has coordinates

$\dfrac12\left((0,450)+(450,0)\right)=(225,225).$

To make (225, 225) the new “origin,” we can just subtract 225 from the x– and y-coordinates of our points, like this:

Remember that the positive y-axis points down in Processing, which is why we use an expression like 225 – y rather than y – 225.  This produces the following video.

This isn’t quite what we want yet, but you’ll notice what’s happening.  The midpoint of the hypotenuse is now always at the upper left corner.  As the triangle rotates, most of it is outside the view screen.  But that’s not hard to fix.

All we have to do now is move the midpoint of the hypotenuse to the center of the screen.  We can easily do this using the translate function.  So here is the complete version of the sierpinski function, incorporating the translate function as well:

So let’s briefly recap what we’ve learned.  Rotating an image is not difficult as long as you remember that the rotate function rotates about the point (0,0).  So first, we needed to decided what point in user space we wanted to rotate about – and we chose (225, 225) so the fractals would rotate around the midpoint of the hypotenuse of the enclosing right triangle.  This is indicated in how the x– and y-coordinates are changed in the point function.

Next, we needed to decided what point in screen space we wanted to rotate around.  The center of the screen seemed a natural choice, so we used (384, 312).  This is indicated in the arguments to the translate function.

And finally, we decided to have the triangles undergo one complete revolution, so that p = 0 corresponded to no rotation at all, and p = 1 corresponded to one complete revolution.  We accomplished this using linear interpolation, which was incorporated into the rotate function.

But most importantly — we made these changes in the correct order.  If you played around and switched the lines containing the translate and rotate functions, you’d get a different result.

It is worth remarking that it is possible to use the rotate function first.  But then the translate function would be much more complicated, since you would have to take into account where the point (384, 312) moved to.  And you’d have to review your trigonometry.  Here’s what the two lines would need to look like:

As you can see, there is a lot more involved here!  So when you’re thinking about designing algorithms to produce special effects, it’s worth thinking about the order in which you perform various tasks.  Often there is a way that is easier than all the others — but you don’t always hit upon it the first time you try.  That’s part of the adventure!

Next week we’ll look a few more special effects you can incorporate into your movies.  Then we’ll look at actual movies made by students in my linear algebra class.  They’re really great!

## Logic Puzzles II

Last week, we looked at solving some simple logic puzzles.  This week, the logic puzzle is quite a bit more involved —  I hope you enjoy it!

Six logical friends — Arlen, Boris, Cecil, Doran, Edith, and Frank — having just finished some pretty hairy logic problems, decided to go to Wacky Jack’s Primo Ice Cream Emporium to celebrate. Each ordered their ice cream in a waffle cone or a dish, except for the one who ordered the Slurp-A-Licious Bucket-O-Yum — a delectable concoction with two scoops each of Jack’s five Specialty Flavors — in which case it came in a commemorative Wacky Jack Bucket (which you got to keep if you ate it all). From the following clues, can you decide who ordered what?  Note: All solvers made their selections from Jack’s five Specialty Flavors: Blueberry Farkle, Chocolate Smudge, Marshmallow Whoop, Pecan Passion, and Peppermint Blast. For the cones, you must specify the order of the scoops.

1. No cone had more than three scoops of ice cream, and no dish had more than five.
2. Except for the problem solver who got the Slurp-A-Licious Bucket-O-Yum, no one got more than one scoop of the same flavor.
3. The number of scoops in Edith’s dish was the same as the sum of the numbers of scoops in Arlen’s and Cecil’s cones.
4. Cecil and Edith together had the same number of scoops as Arlen and Frank together.
5. If Frank had an even number of scoops, then there were 23 scoops among the six solvers.
6. If Frank had an odd number of scoops, then there were 25 scoops among the six solvers.
7. If Boris had an odd number of scoops, then Edith had an even number.
8. Boris had fewer scoops than Doran.
9. Exactly two solvers had exactly three scoops of ice cream.
10. Frank ordered a dish if and only if Boris ordered a cone.
11. Arlen had three scoops of ice cream if and only if no two cones had the same number of scoops.
12. Exactly four solvers had Marshmallow Whoop, exactly four had Pecan Passion, and exactly two had both.
13. Either Arlen’s flavors were a subset of Edith’s, or Frank’s were a subset of Cecil’s.
14. Frank did not order Pecan Passion, and Cecil did not order Marshmallow Whoop.
15. If Cecil ordered just one scoop, then Arlen ordered Pecan Passion.
16. Boris and Doran were the only two to order Peppermint Blast.
17. Arlen and Frank had no flavors in common if and only if Boris and Frank had exactly one flavor in common.
18. Two cones had a scoop of Chocolate Smudge second from the top.
19. Frank had exactly two scoops if and only if Pecan Passion was always the bottom scoop of the cone it was on.