Publication date: 08/13/2020

Setting Up a Perspective Scene

To set up a perspective scene in JSL, send the Perspective command to a display list.

Perspective (angle, near, far)

where angle is the viewing angle, near is the distance to the near plane, and far is the distance to the far plane, as illustrated in the drawing above. A couple of things need to be remembered when defining the viewing space.

Items outside the viewing space (for example, closer than the near plane or farther than the far plane) are not drawn. They are clipped off.

The ratio of far to near needs to be small. This enables the rendering engine to effectively determine which items should be drawn “on top of” other items, simulating closeness of items. The near argument must be greater than zero.

The “Hello World” example contains the line

scene << Perspective( 45, 3, 7 ); // define the camera

This defines a 45-degree viewing angle, with a near plane 3 units from the viewer and a far plane 7 units from the viewer.

The viewing angle functions in the same way as a wide angle or telephoto lens on a camera. Small viewing angles zoom into a drawing; wide angles zoom out. In other words, a small viewing angle maps the screen space onto a small portion of the scene, resulting in apparently larger scene elements. A large viewing angle maps the screen space onto a large portion of the scene, resulting in apparently small screen elements. The size of scene elements can therefore be manipulated using the angle argument of the Perspective function. The picture here shows the hello world script with perspective angles of 45 and 90 degrees.

Figure 13.6 Changing the Perspective 

As an alternative to the Perspective command, you can define the actual viewing frustum with the Frustum command.

Frustum(left, right, bottom, top, near, far);

The frustum's viewing volume is defined by (left, bottom, near) and (right, top, near), which specify the (x, y, z) coordinates of the lower left and upper right corners of the near clipping plane; near and far give the distances from the viewpoint to the near and far clipping planes.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).
.