Message Boards Message Boards

Anamorphic Reflections in a Christmas Ball

Posted 5 years ago

Open in Cloud | Download to Desktop via Attachments Below

Forgot to add the end result

I recently got inspired by a sculpture sold on Saatchi Art featuring anamorphic deformation by reflection in a spherical mirror. Being curious and interested in anamorphic transformations, I wanted to build something similar and find the math behind it using Mathematica...

Saatchi art

A plain, undecorated Christmas ball can serve as a perfect convex spherical mirror to test some of our physics and coding skills. I used a 7 cm XMas ball now dumped in stores for Euro1.75 a sixpack! In a nutshell: I wanted to see how a deformed text should look like in order to show up undeformed when reflected in a ball shaped mirror. Xmass ballls

The graphics below show a spherical mirror centered at C:(0,0,0), our eye at viewpoint V: (xv,0,zv) and a reflected point S on the base plane beneath the ball. One of the reflected light rays leaving S will meet the mirror at Q such that its reflection meets the eye at V. But the eye at V will now perceive the point S at I. complete view pane

I is a perceived image point inside the view disk perpendicular to VC. According to the law of reflection, the lines VQI and SRQ will form equal angles with the normal n to the sphere in Q. All image points will be restricted to a disk that is the base of the view cone with the line CV as axis and an opening angle of tan^-1(zv/xv). This image disk is at an offset 1/xv from C and has a radius of Sqrt[1-(1/xv)^2]. view cone

The point Q (q1, q2, q3) is the intersection of the view line VI and the mirror sphere. It can be computed by solving this equation:

solQ = NSolve[
   Element[{x, y, z}, HalfLine[{imagePointI, viewPointV}]] && 
    Element[{x, y, z}, Sphere[]], {x, y, z}];
pointQ = First[{x, y, z} /. solQ]; {q1, q2, q3} = pointQ;

The points C, Q, I, V and S are all in the same plane. We have R, the projection of V to the normal n.

projectionPlane = InfinitePlane[pointQ, {pointQ, viewPointV}];
reflectionPt = 2 Projection[viewPointV, pointQ] - viewPointV;

The point S is now the intersection of of the line QR with the base plane. It can be computed by solving this equation:

solS = NSolve[{{x, y, z} \[Element] 
      HalfLine[{{q1, q2, q3}, reflectionPt}] && {x, y, z} \[Element] 
      InfinitePlane[{{0, 0, -1}, {0, 1, -1}, {0, -1, -1}}]}, {x, y, 
    z}];

After simplification, we can write the following function that maps the perceived image point I to the reflected point R :

xmasBallMap[iPt : {yi_, zi_}, vPt : {xv_, zv_}] :=

 Module[{imagePtRotated, solQ, q1, q2, q3},
  (*image point in real (rotated) pane*)
  imagePtRotated = {(1 - zi zv)/Norm@vPt, 
    yi, (xv^2 zi + zv)/xv/Norm@vPt};
  (*intersection viewline-sphere: Q*)
  solQ = NSolve[
    Element[{x, y, z}, HalfLine[{imagePtRotated, {xv, 0, zv}}]] && 
     Element[{x, y, z}, Sphere[]], {x, y, z}];
  {q1, q2, q3} = First[{x, y, z} /. solQ]; 
  Join[{-(1 + q3) (q2^2 + q3^2) xv + q1^2 (xv - q3 xv) + 
      q1^3 (-1 + zv) + q1 q2^2 (-1 + zv) + 
      q1 q3 (q3 (-1 + zv) + 2 zv), 
     q2 (2 q1 xv + q1^2 (-1 + zv) + q2^2 (-1 + zv) + 
        q3 (q3 (-1 + zv) + 2 zv))}/(-2 q1 q3 xv + q3^2 (q3 - zv) + 
      q1^2 (q3 + zv) + q2^2 (q3 + zv)), {-1}]]

All possible image points have to fit inside the lower half-disk. This is a grid of image points inside the view disk:

pts = Table[
   Table[{x, y}, {x, -Floor[Sqrt[1 - y^2], .1] + .1, 
     Floor[Sqrt[1 - y^2], .1] - .1, .025}], {y, 0, -.9, -.025}];
viewDisk = Graphics[{Circle[{0, 0}, 1, {\[Pi], 2. \[Pi]}],
   {AbsolutePointSize[2], Point /@ pts}}, Axes -> True, 
  AxesOrigin -> {-1, -1}, AxesStyle -> Directive[Thin, Red]]

all points in view disk

This is the reflected spherical anamorphic map of these points:

all anamorphic points

We can see that there is a large magnification between the perceived image inside the ball and it reflected image. Getting a point too close to the rim of the view disk will project its reflection far away. This GIF shows the function in action. The image point I follows a circle in the perceived image disk while its reflection S follows the closed curve of its map xmasBallmap(I, v) in the base plane. reflected image gif

We can now further test our function with some text e.g.: "[MathematicaIcon]Mathematica[MathematicaIcon]".

ma = First[First[
     ImportString[
      ExportString[
       Style["\[MathematicaIcon]Mathematica\[MathematicaIcon]", 
        FontFamily -> "Times", FontSize -> 72], "PDF"], 
      "TextMode" -> "Outlines"]]] /. FilledCurve :> JoinedCurve;

The text image needs to be rescaled and centered to fit inside the ball.

maCenteredScaled = 
  ma /. {x_?NumericQ, y_?NumericQ} :> {x, y}*.005 /. {x_?NumericQ, 
     y_?NumericQ} :> {x - .93, y - .45};

This shows the text as should be perceived in the lower half of the mirror sphere:

Mathematica in view disk

This is the code for a 3D view of the complete setup: the spherical mirror, the perceived text in the disk inside the sphere and the deformed, anamorphic image on the base plane.

Quiet@Module[{xv = 10., zv = 3., \[Phi], rotationTF, pointA, viewPt, 
   mathPts, rotatedMathPts, reflectedPts},
  (*view angle*)\[Phi] = ArcTan[xv, zv];
  rotationTF = RotationTransform[-\[Phi], {0, 1, 0}, {0, 0, 0}];
  (*view pane rotation anchor*)
  pointA = {(0 - .01) Cos[\[Phi]], 0, (0 - .01) Sin[\[Phi]]};
  (*point coordinates in y-z plane*)
  mathPts = maCenteredScaled[[-1, 1, All, -1]];
  rotatedMathPts = 
   Map[rotationTF, 
    mathPts /. {y_?NumericQ, z_?NumericQ} :> {0, y, z}, {3}];
  reflectedPts = Map[xmasBallMap[#, {xv, zv}] &, mathPts, {3}];
  Graphics3D[{
    (*reflected image plane (floor)*){Opacity[.45], LightBlue, 
     InfinitePlane[{{0, 0, -1}, {1, 0, -1}, {-1, .5, -1}}]},
    (*mirror sphere*){Opacity[.35], Sphere[]},
    (*center of sphere*){Black, Sphere[{0, 0, 0}, .03]},
    (*percieved image pane*){Opacity[.35], 
     Cylinder[{{0, 0, 0}, pointA}, 1]},
    (*perceived image*){Red, Line /@ rotatedMathPts},
    (*reflected image*){Red, AbsoluteThickness[3], 
     Line /@ reflectedPts}},
   Boxed -> False]]

full 3D view

Time to try the real thing. This shows a 7cm diameter XMas ball mirror with the text reflected in it. Xmass ball real

Get yourself a nice reflecting Christmas ball and this is a pdf for you to printout and try it! (see attached pdf file for printing)

enter image description here

POSTED BY: Erik Mahieu
10 Replies
Posted 5 years ago

The idea of the Chicago bean is wonderful but we have to consider some specifics of a sphere mirror. Only one half of the sphere will reflect the anamorphic image. Either the lower half from an image on the floor below the sphere or the upper half from an image on the ceiling above the sphere.

1.If the anamorphic image is on the floor, the perceived image must be in the lower half of the sphere This could be achieved with a hanging mirror ball. The viewpoint of the observer is at V just above the floor.

enter image description here

2.The anamorphic is on the ceiling and then we perceive it in the upper half of the sphere This could be done by painting the anamorphic image on a ceiling above the ball The viewpoint of the observer is at V just above the floor but higher than the sphere center..

enter image description here

In the case of the "bean", we have here an upper half of a convex (ball like) mirror and the anamorphic image would need to be on some type of suspended ceiling above the bean mirror surface. Not on the floor.

POSTED BY: Erik Mahieu

Very nice.

My first thought was wall art, then I wondered about how high the art would need to be to see the reflection in the reflecting ball that would need to be attached, so table art it is!

It might be fun to try something with the Chicago Cloud Gate (the bean), but the dimensions: Dimensions 10 m × 13 m × 20 m (33 ft × 42 ft × 66 ft) might not make it very feasible to print out something to place at the base of the end of the sculpture.

POSTED BY: Dorothy Evans

Wow, Dorothy, Chicago Cloud Gate is an interesting idea ! We'd need to know the geometry of the bean, but just imagining a giant cryptic scribble on the ground spelling out letters in its reflection got me really thinking... I wonder how one would approach this. Drone might be useful for both: general capture to represent best in online media and also for proper reflective angle positioning, possibly, if human eye level will not properly capture the sensibly sized letters. A street artist who makes ground drawing illusions could possibly be involved. Note people can go also UNDER cloud gate, which gives fantastic reflection geometry.

enter image description here

enter image description here

POSTED BY: Vitaliy Kaurov
Posted 5 years ago

Forgot to add the end result!

Forgot to add the end result

POSTED BY: Erik Mahieu
Posted 5 years ago

For those interested, here is a complete notebook to give it a try with your own Xmas wishes! I could not compile so, it is rather slow, be patient...

Attachments:
POSTED BY: Erik Mahieu

@Erik, this is absolutely wonderful holidays idea. I was thinking one can really hide a secret message for loved ones hardly readable on paper but "magically" revealed by a Christmas Ball. What a fun computational project!

POSTED BY: Vitaliy Kaurov
Posted 5 years ago

This is really impressive!

POSTED BY: Kyle Martin
Posted 5 years ago

Great post after Cylinder Mirror?Echer-Style in reverse ?

POSTED BY: Frederick Wu

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming, and consider contributing your work to the The Notebook Archive!

POSTED BY: Moderation Team

Really cool! Thanks for sharing!

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract