## Documentation Center |

Parallel projection without perspective distortion

Setting `OrthogonalProjection` = `TRUE`,
a camera uses parallel projection without perspective distortion.

By default, a camera uses `OrthogonalProjection` = `FALSE`.
Depending on the distance of the camera to the graphical scene (set
by the attribute `Position`), the scene is subject to some
natural perspective distortion. The distortion is large when the camera
is near the scene. It is small when the camera is far away.

In principle, using parallel projection is equivalent to placing a camera at a very large distance from the scene, looking through a very powerful tele lense.

For technical reasons, however, you should *not* suppress
perspective distortion by placing the camera yourself somewhere far
away via the attribute `Position` and turning the camera's lens
into a tele lense by setting a small value for its opening angle (cf. `ViewingAngle`).
This may lead to problems with the hidden line algorithm used by the
3D renderer. Further, a suitable opening angle has to be found experimentally
such that the scene fills a reasonable portion of the drawing area.

Use `OrthogonalProjection` = `TRUE` instead.
The scaling of the scene is done automatically to fill the drawing
area optimally.

With `OrthogonalProjection` = `TRUE`,
the view is only determined by the direction of the vector from the `FocalPoint` of
the camera to its `Position`. (The camera is moved to infinity
along the ray given by this "optical axis", using an
infinitesimal opening angle.)

The absolute camera position in 3-space as well as its opening angle are ignored.

We look at a box with side length 2 using cameras at different positions. We double the distance between the camera and the center of the box from one scene to the next. At the same time, we use more and more powerful tele lenses by decreasing the camera's opening angle by a factor of , so that the box has approximately the same size.

In

`S1`, the camera is close to the box. The box is distorted heavily.In

`S2`, the camera is farther away. The perspective distortions are smaller.In

`S3`, the distance of the camera to the box center is about 5 times the diameter of the box. Only minor perspective distortions are visible.In

`S4`, the distance of the camera is about 10 times the diameter of the box. The perspective distortions are almost gone:

b := plot::Box(-1..1, -1..1, -1..1, Filled = FALSE, LineColor = RGB::Black): S1:= plot::Scene3d(b, plot::Camera([ 2, 1.8, 2.5], [0, 0, 0], PI/3)): S2:= plot::Scene3d(b, plot::Camera([ 4, 3.6, 5.0], [0, 0, 0], PI/6)): S3:= plot::Scene3d(b, plot::Camera([ 8, 7.2, 10.0], [0, 0, 0], PI/12)): S4:= plot::Scene3d(b, plot::Camera([16, 14.4, 20.0], [0, 0, 0], PI/24)): plot(S1, S2, S3, S4, Axes = None)

We suppress the distortions completely by setting `OrthogonalProjection` = `TRUE`.
Note the automatic scaling of the scene:

plot(S1, S2, S3, S4, Axes = None, OrthogonalProjection = TRUE)

delete b, S1, S2, S3, S4:

The following camera is too close to the scene to make all parts of the function graph visible:

f := plot::Function3d(sin(x^2 - y^2), x = -2..2, y = -2..2): camera := plot::Camera([2, 2, 2], [0, 0, 0], PI/5): plot(f, camera)

With `OrthogonalProjection` = `TRUE`,
the specified position and opening angle are ignored. The effect of `OrthogonalProjection` is
the same as placing the camera far away and choosing a tiny opening
angle such that the scene fills the drawing area optimally:

camera::OrthogonalProjection := TRUE: plot(f,camera)

delete f, camera:

Was this topic helpful?