![matlab print matlab print](https://www.evamariakiss.de/tutorial/matlab/images/matlab_ide_2.png)
We’ll rotate the vector PC about C by twice the reflection angle: once to bring it along the vector to C, and once more in accordance with the law of reflection.įor each apparent point P, we will have a matrix equation With the reflection angles in hand, we can now specify exactly where the points P’ must be. Since we would like to know both the angle and the orientation (clockwise or counterclockwise) to rotate the point P about C, we should use the ATAN2 function to calculate the angle between the position vector for C and the vector PC from P to C. Now that we know the point of intersection C for each point on the apparent model P, we can find the angles of reflection. Notice that although the quadratic formula gives us two roots, we’ve chosen the one that guarantees that t is always positive. In this way, t is now an n component vector with each component of t associated with each point in the matrix p. The variable p is an n-by-3 matrix representing n points of the apparent model’s triangular vertices, each with 3 cartesian coordinates, and v is a 3 component vector representing the viewing point.
#MATLAB PRINT CODE#
The code above solves the problem for every point on the apparent model. This equality sets up a quadratic equation for the value of t at which J intersects the cylinder. At this point, the position vector of the photon measured from the cylinder’s center will have the same length as the radius of the cylinder, or
![matlab print matlab print](https://i.ytimg.com/vi/Ib6feEw01lU/maxresdefault.jpg)
The photon will hit the cylinder’s surface at some particular t. So as t increases from 0 to 1, the photon moves from P to V. J = P + t*(V-P) where t is in the range , This photon’s journey can be tracked by a vector J defined by position vectors P and V, and a factor t: Imagine a photon traveling along the line PV from P to V. Finally, we know that the light ray CP should have the same length as CP’, so we can find P’ by rotating the point P about C by an angle that satisfies the law of reflection.This is the angle of the reflected ray of light shown in the drawing above. Then we’ll find the angle between the line perpendicular to the cylinder and the line PV.First, we’ll find the point of intersection C between the line PV and the cylinder.This problem can be solved in just a few steps. The rest of the problem focuses on lines and points that are projected onto a plane to create drawings like the one shown above. Each reflected pair of points P and P’ will have the same altitude. Once the intersection points are found, the problem is essentially two dimensional. Since our sculpture of the L-shaped membrane is made up of triangular faces, we need to solve this problem for every triangle vertex. Our task is to figure out where P’ is located given the location of P, V, and the radius of the cylinder. However, the light actually came from some point P’ on our side of the mirror, hit the mirror at some angle, reflected off the mirror at that same angle, and then hit our eyes.ĭrawing of how light reflects off a cylinder from P’ to the viewer’s eye at V, creating the apparent image at P. This line from P to V is the path that our eyes think a ray of light took. For every point P on this apparent sculpture inside the cylinder, we’ll draw a straight line to the eye of the viewer at a point V. Let me explain further by referencing the drawing below. This is the same as imagining that the sculpture is sitting in the center of the cylinder. To make our anamorphic sculpture work with a cylindrical mirror, we have to imagine that the L-shaped membrane is sitting on the other side of the window the mirror appears to make. However, every ray of light that appears to be coming from the other side of the mirror is in fact coming from the same side we are standing on, only bent at angles that we can calculate using the law of reflection. The mirror appears to be a window to an ethereal world on its other side. Reflections off flat mirrors create every-day optical illusions.
![matlab print matlab print](https://i.stack.imgur.com/E28DQ.png)
Simple case of the law of reflection where the mirror is flat. The law of reflection notes that if a ray of light hits a mirror at an angle measured off a line perpendicular to the mirror, then the reflected ray of light will come off the mirror at that same angle. To make an anamorphic sculpture look intelligible when reflected off a curved mirror, the only physics you need is the law of reflection.