The mathematics behind projections

Similar documents
1.5 Equations of Lines and Planes in 3-D

Chapter 23. Geometrical Optics: Mirrors and Lenses and other Instruments

Review Exercise. 1. Determine vector and parametric equations of the plane that contains the

Mathematics 308 Geometry. Chapter 9. Drawing three dimensional objects

1 EquationsofLinesandPlanesin 3-D

1.5 Equations of Lines and Planes in 3-D

Suggested problems - solutions

12.7 Tangent Planes and Normal Lines

Rectangular Coordinates in Space

Basics of Computational Geometry

Section 13.5: Equations of Lines and Planes. 1 Objectives. 2 Assignments. 3 Lecture Notes

JUST THE MATHS SLIDES NUMBER 5.2. GEOMETRY 2 (The straight line) A.J.Hobson

Lines and Planes in 3D

Notes on Spherical Geometry

Mathematical Analysis of Tetrahedron (solid angle subtended by any tetrahedron at its vertex)

Planes Intersecting Cones: Static Hypertext Version

11.2 RECTANGULAR COORDINATES IN THREE DIMENSIONS

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

Reflection & Mirrors

Background for Surface Integration

MATHEMATICS 105 Plane Trigonometry

Introduction to Transformations. In Geometry

Answer Key: Three-Dimensional Cross Sections

Anamorphic Art with a Tilted Cylinder

Optics II. Reflection and Mirrors

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S

Visualisation Pipeline : The Virtual Camera

How to print a Hypercube

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Section 8.3 Vector, Parametric, and Symmetric Equations of a Line in

Rational Numbers: Graphing: The Coordinate Plane

The Three Dimensional Coordinate System

The Law of Reflection

Geometry R. Unit 12 Coordinate Geometry. Day Classwork Day Homework Wednesday 3/7 Thursday 3/8 Friday 3/9

CSE328 Fundamentals of Computer Graphics

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

Raycasting. Chapter Raycasting foundations. When you look at an object, like the ball in the picture to the left, what do

Three-Dimensional Viewing Hearn & Baker Chapter 7

Section Graphs and Lines

CSE528 Computer Graphics: Theory, Algorithms, and Applications

LINEAR PROGRAMMING: A GEOMETRIC APPROACH. Copyright Cengage Learning. All rights reserved.

Viewing with Computers (OpenGL)

Vectors. Section 1: Lines and planes

INTRODUCTION TO THREE DIMENSIONAL GEOMETRY

CS 4204 Computer Graphics

CSE452 Computer Graphics

Practical Linear Algebra: A Geometry Toolbox

Parallel and perspective projections such as used in representing 3d images.

with slopes m 1 and m 2 ), if and only if its coordinates satisfy the equation y y 0 = 0 and Ax + By + C 2

About Graphing Lines

CSE 252B: Computer Vision II

CHAPTER 5 SYSTEMS OF EQUATIONS. x y

Inversive Plane Geometry

form are graphed in Cartesian coordinates, and are graphed in Cartesian coordinates.

Outcomes List for Math Multivariable Calculus (9 th edition of text) Spring

CS 325 Computer Graphics

6.1 Polar Coordinates

Computer Vision Project-1

Part Images Formed by Flat Mirrors. This Chapter. Phys. 281B Geometric Optics. Chapter 2 : Image Formation. Chapter 2: Image Formation

Structure from Motion. Prof. Marco Marcon

Answers to practice questions for Midterm 1

Multiple View Geometry in Computer Vision

UNIT NUMBER 5.2. GEOMETRY 2 (The straight line) A.J.Hobson

Revision Problems for Examination 2 in Algebra 1

Complex Numbers, Polar Equations, and Parametric Equations. Copyright 2017, 2013, 2009 Pearson Education, Inc.

(Refer Slide Time: 00:04:20)

Scene Modeling for a Single View

Moore Catholic High School Math Department

Experiments on Animated Visual Forms

DISTANCE FORMULA: to find length or distance =( ) +( )

Scene Modeling for a Single View

WHAT YOU SHOULD LEARN

Three Dimensional Geometry. Linear Programming

3.5 Equations of Lines and Planes

Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer

INTRODUCTION TO COMPUTER GRAPHICS. cs123. It looks like a matrix Sort of. Viewing III. Projection in Practice 1 / 52

Analytical Solid Geometry

Lesson 27: Angles in Standard Position

Let s write this out as an explicit equation. Suppose that the point P 0 = (x 0, y 0, z 0 ), P = (x, y, z) and n = (A, B, C).

Introduction to Computer Vision

volume & surface area of a right circular cone cut by a plane parallel to symmetrical axis (Hyperbolic section)

Chapter 5. Projections and Rendering

A1:Orthogonal Coordinate Systems

Vector Calculus: Understanding the Cross Product

Chapter 23. Geometrical Optics (lecture 1: mirrors) Dr. Armen Kocharian

Light, Photons, and MRI

(Refer Slide Time: 00:02:02)

2D Transforms. Lecture 4 CISC440/640 Spring Department of Computer and Information Science

Topic 1.6: Lines and Planes

Unit 12 Topics in Analytic Geometry - Classwork

Chapter 2 Diagnostic Test

A point is pictured by a dot. While a dot must have some size, the point it represents has no size. Points are named by capital letters..

3D Hyperbolic Tiling and Horosphere Cross Section

Due: Fri Sep :00 PM MDT Question

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

I can identify, name, and draw points, lines, segments, rays, and planes. I can apply basic facts about points, lines, and planes.

Topic. Section 4.1 (3, 4)

9.5 Polar Coordinates. Copyright Cengage Learning. All rights reserved.

Copyright. Anna Marie Bouboulis

Moore Catholic High School Math Department

Transcription:

The mathematics behind projections This is an article from my home page: www.olewitthansen.dk Ole Witt-Hansen 2005 (2015)

Contents 1. The mathematics behind projections and 3-dim graphics...1 1.1 Central projection...1 1.2 Parallel Projection...2 1.3 Determination of the parallel projection of a point...3 1.4 Determination of the central projection of a point...6

The mathematics behind projections 1 1. The mathematics behind projections and 3-dim graphics Doing computer graphics in the plane does usually not involve complex mathematics, as it does when working with projections into a plane from a 3-dim space. In this article we shall only be concerned with the mathematical aspect of projection. How to make a computer program, such that only the parts of the object facing the observer are drawn, are treated in my book (in Danish): Programmering med Delphi from 2004. 1.1 Central projection A central projection is a mapping of an object in space into a plane, as it is seen from an eye point It could for example be a landscape seen through a rectangular opening in a wall corresponding to a painting frame. In a central projection the space is seen, as it is the case for an observer, that is, perspectively. In the perspective view remote objects (and the distances between them), will appear smaller than if they are positioned near to the image plane. For painters the perspective has been a challenge since the medieval. It is a comprehensive part of the learning in every art school, how to draw a correct perspective. And it is certainly not a simple task. The basic methods for a painter is, however, entirely different, from the method used in computer graphics, since a painter initially draws a lot of lines according to certain rules, which all intersects in one point, called the disappearing point. This technique can for example be seen in sketches of Leonardo de Vinci and many others. The separation of the lines is then used as a scale for the objects in a distant position. The painter perspective is founded on a complex technical graphical construction, whereas the perspective in computer graphics is based on mathematical calculations and geometrical constructions. There is also another important difference. Whereas the painter perspective will result in one and only one painting, the computer based perspective (once the objects are determined mathematically), the objects may be seen from any angle and from any eye point. Geometrically the central projection is simple. The observer is placed at the eye point Ø. The image plane Π is placed in an arbitrary position in space. The only things that have to be determined are the shape of the image plane, and the distance from the eye point to the image plane. The object is placed on the opposite side of the image plane when seen from the eye point. To determine the projection of a point P at the object a line is drawn from P to the eye point Ø. The intersection point Q between the image plane Π and the line PØ is then the central projection of P on Π. This is thought illustrated in the figure below.

The mathematics behind projections 2 P Q Ø Figur 1.1 Central projection Later we shall show how to calculate the coordinates to the projection Q, in a coordinate system in the projection plane, once the spatial coordinates to Ø, P is given together with the equation of the plane. 1.2 Parallel Projection A parallel projection may be considered as a limiting case where the eye point is infinitely far from the projection plane. This implies that all lines from the object to the projection plane are parallel. For practically purposes, this means that we may determine the parallel projection of a point P on the object simply as the usual orthogonal projection of a point into a line or into a plane. In a parallel projection, the size of an object is independent of the distance from the image plane. The notion of a 3-dim object only comes about by viewing the angles under which the lines in the object intersects each other. A parallel projection does not represent the surroundings as seen by an observer. This is anyway the case, when the objects in the image plane in the real world have very different distances from the image plane. Even if the parallel projection is not lifelike, it is often use for objects which are not too far away. This has to do with the fact that we see with two eyes, and not one eye point, and two eyes perceptually compensate for the lack of perspective. Below the parallel perspective is illustrated.

The mathematics behind projections 3 Mathematically the parallel projection is easier to handle and requires less calculation as we shall see later. Figure 1.2 Parallel projection 1.3 Determination of the parallel projection of a point The figure below is meant to illustrate how to determine the position of a point into the image plane. n P a pr = n x a n a n = a x n e pr a = OP O Figure 1.4 A parallel projection of a point into the image plane.

The mathematics behind projections 4 The determination of a projection of a point into a plane may in principle be done in to different ways, namely by analytical geometrics or by geometrical vectors. Using analytic geometry it is straightforward. If P is the point, and n is a normal to the image plane Π, we only need to find the parametric for a line through P, that has n as its direction vector, and then find the intersection of this line with the image plane Π. This is of course perfectly correct, but a problem arises, since the coordinate of the intersection with the plane are in a 3-dim space (x, y, z) coordinate system, but what we really want is the 2-dim screen coordinates, with its origin in the lower left corner of the screen. The meaning of the vectors should almost be clear from the figure above. n is a unit normal to the projection plane. P is the point in space, the projection of which we aim to determine. a = OP is the position vector from the origin O to P. We do the determination of the projection of P, using geometrical vectors, since then it is almost straightforward to find the coordinate of the projection in the projection plane. First we determine a n, which is the cross product of a and n. This vector is orthogonal to both a and n, and it lies therefore in (parallel to) the plane Π. Subsequently we determine a vector a pr, which is the cross product of n with a n. This vector also lies in the plane Π, and it spans together with a the plane with is orthogonal to Π. We may therefore find a position vector to the projection Q of P on Π, which is the projection of a on a pr. We first find a unit vector e pr, which is aligned to a pr, and the projection p pr is then found as demonstrated below. The coordinates (x,y) to Q in the coordinate system of the projection plane is then simply found by taking the scalar product of p pr with the two base vectors i and j. n a n a pr n an e pr a OQ p a e pr r ( pr ) a a 1 pr e pr x p i r y p r j The determination of the parallel projection is different from, but not much simpler, than that of the central projection. There is however a decisive mathematical difference, which makes parallel projection easier to cope with than central projections. All the vector operations, which are applied to determine the parallel projection of a point are linear operations, which should be understood such: As if you want to determine the projection of a linear combination c of two vectors : c = s a + t b, then it is equal to: c pr = s a pr + t b pr. This implies that doing a parallel projection, you only need to determine the projection of the three base vectors e 1, e 2, e 3 in the 3-dim coordinate system. The projection of any other vector a having coordinates (x,y,z). a = x e 1 + y e 2 + z e 3 can then be determined as the same linear combination of the projected bases vectors: a pr = x e 1pr + y e 2pr + z e 3pr. The projection of the base vectors e 1pr, e 2pr, e 3pr, however, all lie in the image plane, naturally.

The mathematics behind projections 5 To make a parallel projection of a point it is thus only necessary to make six multiplications, which is much less than for a central projection. Below is shown a computer generated parallel projection of a swim ball and a colorized dodecahedron (The bad quality of the image is caused by that it is a photo taken from a computer screen).

The mathematics behind projections 6 1.4 Determination of the central projection of a point. We shall then look at the geometrical method to find the central projection of a point on a screen. As it was the case with the parallel projection, the calculations are made using geometrical vectors, which makes the results independent of the coordinate system chosen. The drawing below shows how the calculations are done. It is not entirely trivial. P n p Q P 0 d n j i d 0 O O Figue 1.5 The entral projection of a point on a screen. Since the result, when expressed by vectors is independent of the coordinate system, we shall choose the 3-dim coordinate system to have the x y plane parallel to the image plane, and therefore share the same two base vectors (i, j). The spatial coordinate system has its origin O together with the three base vectors (e 1, e 2, e 3 ) = ((1,0,0), (0,1,0), (0,0,1)). The eye point lies on the positive z axis at the distance d-d 0. The image plane is perpendicular to the z-axis at the distance d 0 from O. The z-axis is directed towards the eye-point. The coordinate system of the image plane has its origin at O and base vectors i and j. The eye-point is at P 0. We then wish to find the projection Q of a point P, which lies on the object in space. n is a unit vector, which is perpendicular to the projection plane. The distance from the origin O to the plane is denoted d 0, and n p is a unit vector parallel to P0 P. The determination of the coordinates (x,y) to the position vector O Q is the done in the following calculations.

The mathematics behind projections 7 0 OP0 OP n PP 0 PP p 1 PP 0 We wish to determine t p, such that we may express the vector from the point P of the object to the intersection of line with the projection plane using n p : PQ t p n p Taking the scalar product with n on both sides we find: n PQ t n n and n PQ n ( OQ OP) d p p 0 (Since the projection of OQ on n is d0 ), From which follows: ( d n OP) t 0 p n n p Furthermore we have: OQ OP PQ O Q OQ OO nop Where O is the origin of the coordinate system in the projection plane. Then we can find the coordinates (x,y) to the projection Q of the point P in the coordinate system of the projection plane (O π, i, j). x i O Q and y jo Q The signed projection of OP on n is n OP. (Positive in the figure above). Cosine to the angle between n and n p is determined as: n n p. (in the figure a negative number). What we want is to find the length PQ. But this length is precisely the distance from P to Π divided by cos(v). The distance from P to Π is then calculated as the length of the projection ofop on n minus d 0. (That the difference is inverted in the expression above for t p,is caused by the sign of cos v). t p is thus the length of PQ, from which follows: PQ = t p n p. Then it is only a minor problem to find the position vector for Q in the coordinate system of the projection plane, shown by the equations above. Finally the coordinates to the projection point Q (x,y) by taking the scalar product with the two base vectors (O π, i, j).

The mathematics behind projections 8 Since the calculation of the central projection involve non linear operations (the determination of t p ), it is not possible (as it was the case for the parallel projection) to settle for finding the projection of the three base vectors, and expanding the projection on these, using the same coordinates as for the point P in 3-dim space. The calculation must be performed for each projected point. Below is shown a computer generated central projection. (A painters view of a tile walk, which prior was a mandatory craftsman test in all painting educational schools. To document that the projection is made by using the formulas above and not just painted by hand. The tile walk is shown from two different eye points. (The image quality is bad, yes because it is a photo of a screen)