Excel Optical Illusions #4

| 5 Comments | 0 TrackBacks

This week's optical illusion was a little more challenging, but I think it came out just fine.

optical_illusions_frasers_spiral.png
The rope is not a spiral, but rather a series of circles. You can check a box that spoils the illusion with a mask.

There's some pretty cool Excel charting going on here. All of the swaths are drawn from formulas. Have fun tearing it apart!

I'll have another next Friday...

Here's the workbook:


Reblog this post [with Zemanta]
If you liked this article, please share it!



Your Ad Here

No TrackBacks

TrackBack URL: http://www.excelhero.com/cgi-bin/mt/mt-tb.cgi/19

5 Comments

Thanks for your challenging excels.

With Frasers Spiral there are many named formulae to enter. Do you have an automated method to create the names and/or formula?

@MikeD-

Thanks for commenting!

I certainly do. It would be insane to enter that many formulas and chart series by hand. Here is the VBA I used to do that (note that it takes a few minutes to run, but you can see all of the progress on the chart as it is happening):


Public Sub AddFormulasAndSeries()

Dim swaths As Long
Dim veins As Long
Dim j As Long, k As Long

swaths = 20
veins = 6

Sheet1.ChartObjects(1).Activate

Application.Calculation = xlCalculationManual
With ThisWorkbook.Names
For k = 0 To swaths - 1
For j = 0 To veins - 1
.Add Name:="_" & Format(k, "00") & j & "x", RefersTo:=Array(1)
.Add Name:="_" & Format(k, "00") & j & "y", RefersTo:=Array(1)
.Add Name:="_" & Format(k, "00") & j & "xr", RefersTo:=Array(1)
DoEvents: DoEvents
Next j
Next k
End With

For k = 0 To swaths - 1
For j = 0 To veins - 1
With ActiveChart.SeriesCollection.NewSeries
.Name = Format(k, "00") & j
.XValues = "1!_" & Format(k, "00") & j & "x"
.Values = "1!_" & Format(k, "00") & j & "y"
.Border.Color = RGB(255, 159, 128)
.Border.Weight = xlMedium
End With
DoEvents: DoEvents
Next j
For j = 0 To veins - 1
With ActiveChart.SeriesCollection.NewSeries
.XValues = "1!_" & Format(swaths - 1 - k, "00") & j & "xr"
.Values = "1!_" & Format(swaths - 1 - k, "00") & j & "y"
.Border.Color = RGB(255, 159, 128)
.Border.Weight = xlMedium
End With
DoEvents: DoEvents
Next j
Next k

For k = 0 To swaths - 1
For j = 0 To veins - 1
ThisWorkbook.Names.Add Name:="_" & Format(k, "00") & j & "x", RefersTo:= _
"=COS(k*" & k & ")*COS(j*" & j & ")*(a*b^t*COS(t) - a*b^t*SIN(t)*SIN(j*" & j & ")) - (COS(j*" & j & ")*a*b^t*SIN(t) + a*b^t*COS(t)*SIN(j*" & j & "))*SIN(k*" & k & ")"

ThisWorkbook.Names.Add Name:="_" & Format(k, "00") & j & "y", RefersTo:= _
"=COS(k*" & k & ")*(COS(j*" & j & ")*a*b^t*SIN(t) + a*b^t*COS(t)*SIN(j*" & j & ")) + (COS(j*" & j & ")*a*b^t*COS(t) - a*b^t*SIN(t)*SIN(j*" & j & "))*SIN(k*" & k & ")"

ThisWorkbook.Names.Add Name:="_" & Format(k, "00") & j & "xr", RefersTo:= _
"=-(COS(k*" & k & ")*COS(j*" & j & ")*(a*b^t*COS(t) - a*b^t*SIN(t)*SIN(j*" & j & ")) - (COS(j*" & j & ")*a*b^t*SIN(t) + a*b^t*COS(t)*SIN(j*" & j & "))*SIN(k*" & k & "))"

DoEvents: DoEvents
Next j
Next k
Application.Calculation = xlCalculationAutomatic

End Sub


Regards,
Daniel Ferry
excelhero.com/blog

@MikeD-

While the VBA code I posted in the last comment looks truncated on the right, it is not. If you select the text for the procedure and copy it, you will get it all including the bits that extend to the right past the visual column.

The code should be pasted into a module in the workbook.

Regards,

Daniel Ferry
excelhero.com/blog

Daniel, thanks for your reply but I can't read them! There are no comments available at http://www.excelhero.com/blog/2010/03/excel-optical-illusions-4.html - the header says "0 Comments".

However ,at http://www.excelhero.com/blog/2010/03/ the header says "3 Comments".

I've tried IE and Firefox.

@MikeD-

I just sent you a PM with the VBA procedure.

Regards,

Daniel Ferry
excelhero.com/blog

Leave a comment

About this Entry

This page contains a single entry by Daniel Ferry published on March 12, 2010 6:15 PM.

Monte Carlo PI was the previous entry in this blog.

Bezier Curve Chart is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.