- Synopsis
**PERSPECTIVE**- Description
Tells the turtle to enter "perspective" mode. Perspective mode adds a third dimension (Z axis) for the turtle to live in. Perspective is a term to describe how we view a three-dimensional world on a two-dimensional surface. You should be familiar with using FMSLogo in 2D before jumping into 3D.

You can switch out perspective mode by entering any of the 2D modes: WRAP, WINDOW, or FENCE.

Everything that works in 2D applies in 3D (perspective mode). For example, if you had code that drew a 2D picture, say a star, you can run the same code and place that star on six sides of a cube by getting the turtle to the correct 3D coordinate and orientation before you run your 2D command for drawing a star.

You move the turtle just like you fly an airplane. Airplanes have 3 controls to move them through 3D space. They have elevators on the tail (pitch), a rudder on the fin (yaw) and ailerons on the wings (roll). In 2D, you only have a rudder (right/left) also known as "yaw" and you only move around on one geometric plane. FMSLogo offers the additional controls, ailerons (RIGHTROLL and LEFTROLL) and elevators (UPPITCH and DOWNPITCH) to maneuver 3D space. In 3D space, you can move around in an infinite number of geometric planes at any orientation. Once you set the pitch and roll to select the desired geometric plane you can use familiar 2D commands (FORWARD, BACK, LEFT, RIGHT) to traverse it.

When you start at (X=0, Y=0, Z=0) the +Y axis is still up the screen and the +X axis is to the right of the screen. But now you can go into the screen (away from you) or out of the screen (closer to you). How? Just like an airplane flies. When an airplane rolls to the right it does not change its trajectory, and neither does the turtle. But if you rolled 90 degrees to the right and then take a right turn guess what happens. You'll go down real fast, straight down. Think of a real turtle on the floor. Now roll him on to his right side. Now if he takes a right turn towards his right front leg (like he always does) his nose will face the floor. FORWARD will now go down in the Z axis (away from you).

For more information on maneuvering in 3D, read the section on understanding your orientation in 3D.

There is a simple 3D introductory example called

`3DSTEPS.LGO`

in the`Examples`

directory. Load it, run it, and understand it thoroughly before moving on.The table below summarizes of the relationship between commands in 2D mode and 3D mode. Many commands are repeated in both columns because they are designed for 2D mode but their behavior is affected by being in 3D mode.

2D Command 3D Command SETXY SETXY (does not change z-coordinate) SETXYZ SETX (does not change y-coordinate) SETX (does not change y-coordinate or z-coordinate) SETY (does not change x-coordinate) SETY (does not change x-coordinate or z-coordinate) SETZ (does not change x-coordinate or y-coordinate) XCOR XCOR YCOR YCOR ZCOR POS POS (z-coordinate is ignored) POSXYZ SETPOS SETPOS (does not change z-coordinate) SETPOSXYZ TOWARDS TOWARDS TOWARDSXYZ DISTANCE DISTANCE DISTANCEXYZ HEADING HEADING ROLL PITCH ORIENTATION SETHEADING SETHEADING SETROLL SETPITCH SETORIENTATION RIGHT RIGHT (on current plane) RIGHTROLL UPPITCH LEFT LEFT (on current plane) LEFTROLL DOWNPITCH WINDOW PERSPECTIVE WRAP FENCE SETTURTLE 0-1023 SETTURTLE 0-1023 SETTURTLE -1 (the eye position) SETTURTLE -2 (where the eye is looking) SETTURTLE -3 (the position of the light) POLYSTART POLYEND POLYVIEW LIGHT SETLIGHT ELLIPSEARC ELLIPSEARC (great for spheres) **Limitations of Perspecive Mode.**There are several 2D commands which work in perspective mode but still behave in a 2D fashion. Their actions take place at the correct X, Y, Z coordinate, but the orientation is limited to a 2D plane. For example, you can not draw text with LABEL on 6 sides of cube. However, you can LABEL the 8 vertices of the cube by moving to each vertex using 3D maneuvers. Furthermore, nothing prevents you from building a "3D block letter" alphabet library made up of 3D vectors.The following commands retain their 2D feel, even in perspective mode.

LABEL

BITCUT

BITPASTE

BITCOPY

BITBLOCK

FILL

PIXEL

SETPIXEL

Perspective mode does not do hidden line removal. Hidden line removal requires objects be composed of polygons. Perspective mode does not allow you to dynamically move the eye view. This is because FMSLogo does not store your object (your vectors) in 3D, it stores them in a 2D bitmap. However you can do "fast" dynamic manipulation in two other ways.

One simple way is to keep your scene very simple (relative to the performance of your computer). You simply clear the screen and change the eye view (turtle -1) or the placement of the objects and draw again. Note curved objects (like those based on ELLIPSEARC) generate many vectors. The other option is to record each "scene" in a bitmap and play them back at any rate you wish. This method is shown in the

`GROW.LGO`

example. It does not matter whether you're "recording" 2D scenes or 3D scenes. This is limited by how much memory your computer has.- Example
`PERSPECTIVE REPEAT 72 [ELLIPSEARC 90 100 150 45 RIGHTROLL 5]`