Top Banner

of 24

4.TRANS_3D

Jun 01, 2018

Download

Documents

anishnair94
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/9/2019 4.TRANS_3D

    1/55

    Three - Dimensional

  • 8/9/2019 4.TRANS_3D

    2/55

    Three-Dimensional Gra hics

    Use of a right-handed coordinate system(consistent with math)

    -

    .To transform from right to left, negate the

    z values.

    Ri ht Handed S ace Left Handed S ace

  • 8/9/2019 4.TRANS_3D

    3/55

    Homogeneous representation of aoint in 3D s ace:

    wzyx T P

    point)3Dafor1,w(

    represented by 4x4 matrices:P’ = A.P

  • 8/9/2019 4.TRANS_3D

    4/55

    Transformation Matrix in 3D:

    pcba

    r i g A

    snml where,

    cbaproduces linear transformations:

    i

    e sca ng, s ear ng, re ec onand rotation.

    K = [p q r] T, produces translation

    = [l m n] T, yields perspective transformation

    while, = s, is responsible for uniform scaling

  • 8/9/2019 4.TRANS_3D

    5/55

    x 010

    x t

    000 z S 100 z t 10001000

    ScaleTranslation

    001 x Sh Shear

    010 z

    y

    Sh 1000

    by scale and shear

  • 8/9/2019 4.TRANS_3D

    6/55

    3D Reflection:

    The following matrices:0001 0001 0001

    0100 XY T

    0100YZ T

    0100 ZX T

    1000

    1000

    1000

    produce reflection about:

    plane plane plane

    res ectivel .

  • 8/9/2019 4.TRANS_3D

    7/55

    Rotation Matrices alon an axis:

    0sin0cos 0010

    0)sin()cos(0

    1000 1000

    X-axis Y-axis

    00γsinγcos

    0100γ

    cosγ

    s n Z-axis

    Why is the sign reversed in one case ?

  • 8/9/2019 4.TRANS_3D

    8/55

    Y Around-

    X Around-

    Z Around-

    X ZY

  • 8/9/2019 4.TRANS_3D

    9/55

    Z 0001 X

    X-axis0)sin()cos(0

    Y

    Y1000

    Y 00γsinγcos X

    Z-axis 0100

    00γcosγsin Z

    X1000

    X Around 0)sin(0)cos( X -ax s

    0)cos(0)sin( Z

    Z

  • 8/9/2019 4.TRANS_3D

    10/55

    Rotation About an Arbitrary Axis in Space

    Assume, we want to perform a rotation byegrees, a ou an ax s n space pass ng

    through the point (x 0 , y 0 , z 0 ) with direction

    cos nes c x , c y , c z . . ,

    |T| = - (x0, y

    0, z

    0) T

    . ,principle axes, let's pick, Z (|R x |, |R y |).

    . z .

    4. Then we undo the rotations to align the.

    5. We undo the translation: translate by- 0 , - 0 , - 0

  • 8/9/2019 4.TRANS_3D

    11/55

    in step (2), as given before.

    This is going to take 2 rotations:

    i About x-axis(to place the axis in the xz plane)

    and

    ii) About y-axisto p ace t e resu t co nc ent w t t e

    z-axis).

  • 8/9/2019 4.TRANS_3D

    12/55

    z First ste of Rotation:

    c yd

    c z

    0

    xc x

    o a on a ou x y :

  • 8/9/2019 4.TRANS_3D

    13/55

    Pro ect the unit vector alon OP intothe yz plane.

    The y and z components, c y and c z , arethe direction cosines of the unit vector

    a ong e ar rary ax s.It can be seen from the dia ram that :

    22 C

    z y c

    d cos s n 22 cc d sin

  • 8/9/2019 4.TRANS_3D

    14/55

    z

    zAfter first step

    c

    d

    cP c z

    0

    x, ,x

    ydx

    x

  • 8/9/2019 4.TRANS_3D

    15/55

  • 8/9/2019 4.TRANS_3D

    16/55

    Final Transformation matrix for 3D rotation,a out an ar trary ax s:

    M = |T| |R x | |R | |R z| |R | -1 |R x | -1 |T| -1where: 0001

    010 00

    y ;00 d d R

    y z

    x

    100 0 z 00 d d z y

    0010 x

    00cossin

    00 d C x y 0100 z

  • 8/9/2019 4.TRANS_3D

    17/55

    = x y z y - x - -

    - x y z x y

    = R -1

    A special case of 3D rotation:

    o a on a ou an ax s para e o acoordinate axis (say, parallel to X-axis):

    M = T R T -1

  • 8/9/2019 4.TRANS_3D

    18/55

    Rotation About an Arbitrary Axis in Space

    Assume, we want to perform a rotation byegrees, a ou an ax s n space pass ng

    through the point (x 0 , y 0 , z 0 ) with direction

    cos nes c x , c y , c z . . ,

    |T| = - (x 0 , y 0 , z 0 ) T . ,

    principle axes, let's pick, Z (|R x |, |R y |). . z .

    4. Then we undo the rotations to align the.

    5. We undo the translation: translate by- 0 , - 0 , - 0

  • 8/9/2019 4.TRANS_3D

    19/55

    z

    zAfter first step

    c

    d

    cP c z

    0

    x, ,x

    ydx

    x

  • 8/9/2019 4.TRANS_3D

    20/55

    Final Transformation matrix for 3D rotation,a out an ar trary ax s:

    M = |T| |R x | |R | |R z| |R | -1 |R x | -1 |T| -1where: 0001

    010 00

    y ;00 d d R

    y z

    x

    100 0 z 00 d d z y

    0010 x

    00cossin

    00 d C x y 0100 z

  • 8/9/2019 4.TRANS_3D

    21/55

    you are g ven po n s ns ea on e

    axis of rotation), you can calculate the directioncos nes o e ax s as o ows:

    z z y y x x V T

    101

    c x 01

    y

    V.vector theof lenght theisV where

    z

    ||

  • 8/9/2019 4.TRANS_3D

    22/55

    Reflection throu h an arbitrar lane

    about an arbitrary axis.

    M = |T| |R x | |R y | |R fl| |R y | -1 |R x | -1 |T| -1

    T does the job of translating the origin to

    the lane.R x and R y will rotate the vector normal to

    t e re ect on p ane at t e or g n , unt t scoincident with the +Z axis.

    R fl is the reflection matrix about X-Y

    .

  • 8/9/2019 4.TRANS_3D

    23/55

    definition of objects. Also called

    o e ng space.

    W o r l d S p a c e :

    where the scene and viewinspecification is made

    E y e s p a c e (Normalized Viewing Space):

    looking down the Z axis.

  • 8/9/2019 4.TRANS_3D

    24/55

    A 3D Pro ective s ace.Dimensions: [-1:1] in X & Y, [0:1] in Z.

    This is where image space hidden.

    S c r e e n S p a c e ( 2 D ) :

    Range of Coordinates - ,

  • 8/9/2019 4.TRANS_3D

    25/55

  • 8/9/2019 4.TRANS_3D

    26/55

    Classification of Geometric Projections

    Planar geometricprojections

    Parallel Perspective

    Orthographic Oblique One-point Two-

    pointTop Cabinet

    Other Three-

    Front Side Axonometric Cavalier pointe eva on e eva on

    Isometric Other

  • 8/9/2019 4.TRANS_3D

    27/55

    Distance from COP to projection

    parallel & we specify a center of.

    Center of Projection is also called

  • 8/9/2019 4.TRANS_3D

    28/55

    The size of the perspectiveprojection of the object varies inverselywith the distance of the object from thecenter of projection.

    The perspective projections of any

    to the projection plane converge to avanishing point .

  • 8/9/2019 4.TRANS_3D

    29/55

  • 8/9/2019 4.TRANS_3D

    30/55

    Projectionplane

    Center ofprojection

    Plane normal

  • 8/9/2019 4.TRANS_3D

    31/55

    Projection plane

    x-axis z-axis

    en er o ro ec on

  • 8/9/2019 4.TRANS_3D

    32/55

    X or Y P(X,Y,Z)

    PP

    x p or y p

    O (COP)

    d d l

  • 8/9/2019 4.TRANS_3D

    33/55

    Perspective Geometr and Camera Models

    F P(X,Y,Z)X or Y

    IP X or YP X,Y,Z

    PP x or y

    (COP) ZO

    Perspective Geometry and Camera Models

  • 8/9/2019 4.TRANS_3D

    34/55

    Perspective Geometry and Camera Models

    X or Y P(X,Y,Z)

    x p or y p X or Y P(X,Y,Z)

    O (COP) PP

    COP

    x p or y pZO

    f

    Equations of Perspective geometry, next ->

    i f

  • 8/9/2019 4.TRANS_3D

    35/55

    E uations of ;

    Zf ;

    Zf

    pp

    Perspective geometry

    ;Yy ;Xx pp

    M per

    0f 100 0001

    0010 MP´ = M .P

    T,

    Generalized formulation of

  • 8/9/2019 4.TRANS_3D

    36/55

    Generalized formulation of perspective projection:

    (COP)X or YPP

    P´(x p , y p, Zp)Q

    P(X,Y,Z)(d x, d y, d z)

    (0, 0, Z p )

    Parametric eqn. of the line L betweenan :

    COP + t(P-COP); 0 < t < 1.

    Let the direction vector from (0 0 Z ) to

  • 8/9/2019 4.TRANS_3D

    37/55

    Let the direction vector from (0, 0, Z ) toCOP be (d x , d y , d z),

    and Q be the distance from (0, 0, Z p ) to COP.

    Then COP = (0, 0, Z p ) + Q(d x , d y , d z).

    The coordinates of any point on line L is:´ -x x

    Y´ = Qd y + (Y- Qd y)t;

    ´

    Z´ = (Z p + Qd z) + (Z - (Z p + Qd z))t;

    s ng e con on = p , a e n ersec onof line L and plane PP:

    Qd t z

    Now subsitute to

    z p , p p .

  • 8/9/2019 4.TRANS_3D

    38/55

    d Z

    d Z X x x d d x z z

    1 p

    Z Z Y p

    y z z p1

    d

    Generalized formula of perspective

  • 8/9/2019 4.TRANS_3D

    39/55

    dz

    d01 xp

    x

    dd yydd

    z

    p

    z

    ZZZ

    00 ppgen

    QdQd zz

    100 pzz

    Special cases from the generalized formulation

  • 8/9/2019 4.TRANS_3D

    40/55

    Special cases from the generalized formulationof the perspective projection matrix

    a r xType Zp Q [d x , d y , d z]

    Morth 0 Infinity [0, 0, -1]

    per , , -

    M’per 0 d [0, 0, -1]

    If Q is finite, M gen defines a one-point

    .

  • 8/9/2019 4.TRANS_3D

    41/55

    ara e ro ec on

    Distance from COP to projectionlane is infinite.

    Therefore, the projectors are parallel lines& we need to specify a:

    direction of projection (DOP)Orthographic:

    e rec on o pro ec on an enormal to the projection plane are the same.

    projection plane).

    Classification of Geometric Pro ections

  • 8/9/2019 4.TRANS_3D

    42/55

    Classification of Geometric Pro ections

    Planar geometricprojections

    Parallel Perspective

    Orthographic Oblique One-point Two-

    pointTop Cabinet

    Other Three-

    Front Side Axonometric Cavalier pointe eva on e eva on

    Isometric Other

    Pro ection

  • 8/9/2019 4.TRANS_3D

    43/55

    Pro ection

    ProjectorsPlane(top view)

    Projectors forforside view

    op v ew

    Planeside view

    ProjectionPlane

    ro ec ors orfront view

    (front view)

    xamp e o r ograp c ro ec on

  • 8/9/2019 4.TRANS_3D

    44/55

    Example of Isometric Projection:Projection

    planero ec or

    ro ec on-plane normal

  • 8/9/2019 4.TRANS_3D

    45/55

    use planes of projection that are nottherefore show multiple face of an

    object.) sometr c pro ect on: pro ect on p ane

    normal makes equal angles with eachprinciple axis. DOP Vector: [1 1 1].

    All 3 axis are equally foreshortened

    axes to be made with the same scale.

  • 8/9/2019 4.TRANS_3D

    46/55

    direction of projection differ.

    Principle axis

    Projectors are not normal to theprojection plane

  • 8/9/2019 4.TRANS_3D

    47/55

    plane y

    Projector

    zx

    Projection-plane normal

  • 8/9/2019 4.TRANS_3D

    48/55

    y

    P´l

    xz P 0 0 1

    General obli ue ro ection of a oint/line:

  • 8/9/2019 4.TRANS_3D

    49/55

    Projection Plane : x-y plane; P´ is thepro ect on o P , , 1 onto x-y p ane.

    ` ´vector onto x-y plane and is the angle

    e pro ec on ma es w e x-ax s.

    ` ´ , vary.

    Coordinates of P´: ( l c o s , l s i n , 0).As given in the figure: DOP is:

    (d x , d y , -1) or ( l c o s , l s i n , -1).

  • 8/9/2019 4.TRANS_3D

    50/55

    a s y

    P´l

    xz P 0 0 1

  • 8/9/2019 4.TRANS_3D

    51/55

  • 8/9/2019 4.TRANS_3D

    52/55

    v

    uVPN

    n COP PRP

    -for perspective projection

  • 8/9/2019 4.TRANS_3D

    53/55

  • 8/9/2019 4.TRANS_3D

    54/55

    CW

    VRP

    VPNPRP

    n

    Infinite parallelopiped view volumefor parallel projection

  • 8/9/2019 4.TRANS_3D

    55/55