18
COMPUTER GRAPHICS CH05 – PROJECTIONS

Computer Graphic - Projections

Embed Size (px)

Citation preview

Page 1: Computer Graphic - Projections

COMPUTER GRAPHICSCH05 – PROJECTIONS

Page 2: Computer Graphic - Projections

PROJECTIONS Projections: Transform points in coordinate system of dimension N into a coordinate system of dimension less than N.

In other word, take a point from m dimensions to n dimensions where N<M.

In this chapter we will deal with projection from 3d to 2d

There are two types of projections:1. Parallel.

Orthographic.Oblique.

2. Perspective.

Page 3: Computer Graphic - Projections

PROJECTIONS Projection of a 3D object is defined by straight projection rays (projectors) coming from the center of projection passing through each point of the object and intersecting the projection plane.

Projections requires:1. Projections plane.2. Projections Reference Point (PRP) or Center of

Projection (CRP). The projected view of an object is determined by calculating the intersection of projection lines with the view plane.

Projectors: Lines from coordinate in original space to coordinate in projected space.

Page 4: Computer Graphic - Projections

PARALLEL & PERSPECTIVE PROJECTIONS In parallel projections, coordinate positions are transformed to the view plane (projection plane) along parallel lines (projectors).

In perspective, object position are transformed to the view plane along lines that converge to COP.

In orthographic the direction of projection = normal to the projection plane.

In oblique the direction of projection != normal to the projection plane.

Direction/Center of projection: The main key factors in projection are DOP and COP.

Page 5: Computer Graphic - Projections

PARALLEL & PERSPECTIVE PROJECTIONS If the DOP is the same for all point, then we have parallel projection, else we have perspective projection.

If the distance of COP is finite, then we have perspective projection, else we have parallel projection.

In general, projection is determined by where you place the projection plane relative to principle axes of object (relative angle and position), and what angle the projection make within the projection plane.

Page 6: Computer Graphic - Projections

PARALLEL & PERSPECTIVE PROJECTIONS Perspective:

Size varies inversely with distance (Looks realistic).Distance and angle are not preserved.Parallel lines do not remain parallel.

Parallel:Less realistic.Angles are not preserved.Parallel lines remain parallel.Good for exact measurement.

Page 7: Computer Graphic - Projections

EXAMPLE OF PERSPECTIVE PROJECTION

Page 8: Computer Graphic - Projections

EXAMPLE OF PARALLEL PROJECTION

In Orthographic there is no COP at infinity and A=A’ and B=B’, but in Oblique COP at infinity

Page 9: Computer Graphic - Projections

PERSPECTIVE PROJECTIONS

Perspective projection of a point P with coordinates (X,Y,Z) to position (X’,Y’,Z’) on the view plane.

Page 10: Computer Graphic - Projections

PERSPECTIVE PROJECTIONS X’= X - XU. Y’= Y - YU. Z’= Z – (Z-ZPRP). Parameter U takes values from 0 to 1.

When U= 0.X’= X. Orthographic parallel projectionY’= Y.

When U= 1.X’= 0Y’= 0 (0,0,ZPRP) so the point is at

projection Z’= ZPRP. Reference point PRP

Page 11: Computer Graphic - Projections

PERSPECTIVE PROJECTIONS On the view plane Z’= ZVP. U= (ZVP – Z) / (ZPRP – Z). XP= X ((ZPRP – ZVP) / (Z – ZPRP)) = X (dP / (Z-ZPRP)) YP= Y ((ZPRP – ZVP) / (Z – ZPRP)) = Y (dP / (Z-ZPRP)) Where dP = ZPRP – ZVP is the distance of the view plane VP from the projection reference plane PRP.

Using 3d homogeneous-coordinate representation, we can write the perspective projection transformation as

Page 12: Computer Graphic - Projections

PERSPECTIVE PROJECTIONS Xh = X. Yh = Y. Zh = Z (ZVP / dP) – ZVP (ZPRP / dP). h= (Z / dP) – (ZPRP / dP) XP = Xh / h. YP = Yh / h.

Page 13: Computer Graphic - Projections

PERSPECTIVE PROJECTIONS EXAMPLE EX: If you have a point (2,4,6) and you want to project using perspective projection, suppose that ZPRP=20 and ZVP=10.

dP= ZPRP – ZVP= 20-10 = 10. XP= X (dP / (Z-ZPRP))= 2 (10/-14). YP= Y (dP / (Z-ZPRP))= 4 (10/-14). Using 3d homogenous coordinate: Xh = 2, Yh = 4. h= (6 / 10) – (20 / 10)= -14/10. XP = 2 / (-14/10)= 20/-14. YP = 4 / (-14/10)= 40/-14.

Page 14: Computer Graphic - Projections

PARALLEL PROJECTIONS

Oblique projection of coordinate position (X,Y,Z) to position (XP,YP) on the view plan.

Page 15: Computer Graphic - Projections

PARALLEL PROJECTIONS X’= L * Cos θ. Y’= L * Sin θ. XP= X + X’= X + L * Cos θ. YP= Y + Y’= Y + L * Sin θ. Length L depends on the angle α and the Z coordinate of the point to be projected

Tan α= Z/L. L= Z/tan α= ZL1, where L1 is the inverse of tan α which is also the value of L when Z = 1. We can then write the oblique projection equations as:XP= X + Z(L1 Cos θ).YP= Y + Z(L1 Sin θ).

Page 16: Computer Graphic - Projections

PARALLEL PROJECTIONS

X’= L * Cos θ. An orthographic projection obtained when L= 0. Common choices for θ in 30 and 45, which display a combination view of the top, bottom and sides.

Page 17: Computer Graphic - Projections

PARALLEL PROJECTIONS EXAMPLE EX: If you have a point (2,5,7) and you want to project using oblique projection, suppose that θ=45 and α=45.

L1= 1/tan α= 1. XP= X + Z(L1 Cos θ)= 2 + 7(1 Cos 45)= 2+(7/). YP= Y + Z(L1 Sin θ)= 5 + 7(1 Sin 45)= 5+(7/).

Page 18: Computer Graphic - Projections

EXAMPLE EX: If you have a point (3,4,6) and you have θ=45,α=45, ZPRP=5 and ZVP=2. Find the new coordinate using : (A)Perspective (B)Orthographic (C)Oblique.

(A) dP= ZPRP – ZVP= 5-2 = 3. XP= X (dP / (Z-ZPRP))= 3 (3/1)= 9. YP= Y (dP / (Z-ZPRP))= 4 (3/1)= 12. (B) XP= 3, YP= 4 Just drop Z. (C) L1= 1/tan α= 1. XP= X + Z(L1 Cos θ)= 3 + 6(1 Cos 45)= 3+(6/). YP= Y + Z(L1 Sin θ)= 4 + 6(1 Sin 45)= 4+(6/).