# Design Your Own 3D Optical Illusions

## Summary

Thanks to Mark Veillette, PhD, for helpful contributions and Python code.

Illusion based on the work of Dr. Kokichi Sugihara.

The object looks like an arrow pointing to the right, but its reflection seems to show an arrow pointing to the left.

## Overview

In this lesson your students will design their own 3D objects that exhibit "anomalous mirror symmetry"—that is, their reflections appear flipped left to right when you put them in front of a mirror.

Students will start by defining the outline of a 2D shape using functions. They will then use MATLAB or Python code to convert the 2D shape into a 3D curve that replicates the outline of the 2D shape when viewed from a certain angle. Finally, they will convert the 3D curve into a solid 3D object that can be viewed on a computer or 3D printed.

Working MATLAB and Python code is provided. Your students do not need to write the code from scratch.

## Learning Objectives

- Use piecewise functions to define the outline of a two-dimensional shape
- Use a computer program to generate a three-dimensional optical illusion based on the two-dimensional shape

## Common Core Alignment

**CCSS.MATH.CONTENT.8.F.A.3:**
Grade 8: Functions: Define, evaluate, and compare functions.

Interpret the equation *y = mx + b* as defining a linear function, whose graph is a straight line; give examples of functions that are not linear.

**CCSS.MATH.CONTENT.HSF.IF.C.7:**
High School: Functions: Interpreting Functions: Analyze functions using different representations.

Graph functions expressed symbolically and show key features of the graph, by hand in simple cases and using technology for more complicated cases.

## Materials

Each student or group of students will need:

- A computer with one of these two programming options:
- MATLAB: A campus-wide license, individual student licenses, or a 30-day free trial.
- Google Colab, a programming environment that lets you run Python code in your web browser. Colab is free and you do not need to download anything, but students will need to save a copy of the notebook to their own Google Drive.

- A spreadsheet program like Microsoft Excel® or Google Sheets®

Optionally, the entire class will need:

- Access to a 3D printer
- A mirror

## Background Information for Teachers

*This section contains a quick review for teachers of the science and concepts covered in this lesson.*

The illusion in this lesson is based on the paper Anomalous Mirror Symmetry Generated by Optical Illusion by Dr. Kokichi Sugihara. You can read the paper for the complete details, but we will summarize it here.

The paper presents objects that appear flipped left to right when placed in front of a mirror. One such object is the "impossible arrow" (Figure 1). The shape only looks like an arrow when viewed from the correct angle. When viewed from the top or the side (Figure 2), it does not look like an arrow at all.

The object looks like an arrow pointing to the right, but its reflection seems to show an arrow pointing to the left.

**Figure 1.**The "impossible arrow" illusion. The arrow appears to point to the right, but its reflection in the mirror points to the left.

**Figure 2.**Top and side views of the "impossible arrow" reveal that it does not look like an arrow at all when viewed from these angles.

This illusion works because your brain assumes the top of the object is flat. However, as shown in the side view in Figure 2, the top and bottom surfaces of the arrow are not flat. The shape of these surfaces is carefully defined so it looks like the outline of a two-dimensional arrow only when viewed from a certain angle.

Dr. Sugihara's paper describes how you can start with the outline of a 2D shape in the *x*-*y* plane, defined by top and bottom parametric curves ** a_{1}** and

**(Figure 3). The curves are defined over the interval [-1,1] as functions of the parameter**

*a*_{2}*t*. They can be defined by piecewise functions, but they must be continuous and meet at their endpoints on the

*x*-axis, forming a closed curve. They are

*not*required to be symmetrical about the

*x*axis, although the arrow in Figure 3 is.

**Figure 3.**A two-dimensional drawing of an arrow in the

*x*-

*y*plane, with top curve

**and bottom curve**

*a*_{1}**.**

*a*_{2}The paper presents equations that convert these 2D curves into 3D curves that look like the 2D shape when viewed from an angle *θ* (Figure 4). The view angle is defined downward from a horizontal line that is parallel to the *y*-axis, so looking at the shape directly from the side would be a view angle of 0°, and looking at the shape from directly above would be a view angle of 90°.

A dashed line parallel to the y axis is offset in the positive z direction, with an angle theta defined downward from that line.

**Figure 4.**Definition of the view angle

*θ*.

The equations to convert the the 2D curves ** a_{1}** and

**into 3D parametric curves**

*a*_{2}**and**

*c*_{1}**are:**

*c*_{2}Equation 1:

Equation 2:

where

Equation 3:

Note that since *x* = *t* for both ** c_{1}** and

**, you can substitute**

*c*_{2}*x*for

*t*in the above equations if your students have not yet learned about parametric curves.

The resulting 3D curves ** c_{1}** and

**only look like the original 2D shape when viewed along the**

*c*_{2}*y*-axis at a downward angle

*θ*(Figure 5). When the shape is rotated 180°, its original orientation appears preserved (e.g., an arrow pointing to the right), resulting in the "anomalous mirror symmetry" illusion (Figure 6).

All three views are aligned along the y axis but at three different downward view angles: 90 degrees, 45 degrees, and 0 degrees. The 2D arrow shape is only visible at the 45-degree view angle.

**Figure 5.**Views of the 3D curves

**and**

*c*_{1}**while changing the view angle**

*c*_{2}*θ*.

Rotations about the z axis of 0 degrees, 45 degrees, 135 degrees, and 180 degrees. The 2D arrow is only visible in the 0 degree and 180 degree views. In both cases it looks like the arrow is pointing to the right.

**Figure 6.**Views of the 3D curves

**and**

*c*_{1}**with a constant view angle**

*c*_{2}*θ*=45° while rotating the shape about the

*z*-axis.

While this is sufficient to generate the illusion in a 3D graph, if you want to 3D print the shape, you need to generate an STL file (originally developed for a type of printing called stereolithography). An STL represents the surface of a solid object using triangles. So, for example, an STL file of a cube will consist of twelve triangles, two on each of the six faces of the cube (Figure 7).

**Figure 7.**Left: A cube plotted in 3D space. Right: An STL representation of the same cube, with each face broken up into two triangles.

A triangularized representation of the 3D shape based on the curves ** c_{1}** and

**can be created first by offsetting the curves in the**

*c*_{2}*z*direction (Figure 8), then filling in the sides, top, and bottom of the shape with triangles (Figure 9). This results in a solid 3D version of the illusion (as opposed to a wireframe version) that can be viewed in a 3D graph or exported as an STL for 3D printing or further editing in a CAD program.

**Figure 8.**3D curves offset in the

*z*direction to create the top and bottom edges of the 3D shape.

**Figure 9.**3D shape with the surface filled in with triangles.

In this lesson, your students will define their own 2D shapes using piecewise functions (linear, quadratic, polynomial, trigonometric, etc.—you can decide what is appropriate for your students). They will then enter their shapes into a working MATLAB or Python program that automatically generates the triangularized 3D version of the shape as shown in Figure 9, as well as the intermediate steps (as in Figures 5, 6, and 8). You can choose whether your students just view their shapes in the output MATLAB or Python plots (which can be rotated on the computer screen) or also 3D print them.