Skip to content

CG-Assignment-1

Question-1

Consider the unit sphere centered at the origin as shown in the figure below. An implicit equation of the sphere is x2+y2+z21=0

KGZWcw

Give the matrix S that scales the sphere to the ellipsoid whose radii along the x-, y-, and z-axes are 3, 0.5, and 0.3, respectively. What is the inverse of S?

S=[300000.500000.300001]S1=[0.330000200003.3300001]

Given the matrix R that rotates the ellipsoid -45 degrees about the z-axis. What is the inverse of R?

R=[22220022220000100001]R1=[22220022220000100001]

Give the matrix T that translates the rotated ellipsoid to (10, 4, 2). What is the inverse of T?

T=[10010010400120001]T1=[10010010400120001]

Let M be the matrix representing the overall transformations described in (b), (c), and (d). Give a formula for M in terms of S, R, and T.

M=TRSM=[322240103222404000.320001]

Give a formula for M1

M1=S1R1T1

Let the equation of the ellipsoid by M from the sphere be PTQP=0. Derive a formula for Q.

Q=MTQM

Brief Solution:

The original sphere has the quadratic form:

PTQP=0

After applying the transformation matrix M, the sphere becomes an ellipsoid, and its new quadratic form becomes:

PTQP=0

To derive Q, substitute the transformation P=MP into the above. The transformed equation is:

(MP)TQ(MP)=0

This expands to:

PTMTQMP=0

Thus, the new quadratic form matrix is:

Q=MTQM

Question-2

The following shows a perspective projection where the eye is at the origin, the viewing direction is the opposite of the z-axis, and the projection plane is z=1.

5pWnbl

A point at (x,y,z) in the viewing frustum is projected on (x,y,z). Give the formula to form x,y,z.

x=xzy=yzz=1

Give the 4×4 matrix that represents the projection.

Mperspective projection=[100001000010001d0]

Since d=1, the matrix is:

Mperspective projection=[1000010000100010]

Question-3

1. Write down the steps and the composite matrix for rotating 30 degrees about point (1,2).

Mcomposite=T(1,2)R(α)T(1,2)Mcomposite=[101012001][220.500.5220001][101012001]

2. Write down the composite matrix for rotating 30 degrees about z-axis, then rotating 60 degrees about y-axis.

Mcomposite=Ry(60)Rz(30)Mcomposite=(0.5032001003200.500001)(320.5000.5320000100001)

3. Write down the rotation matrix for rotating 30 degrees about the axis (1,1,1). Note that rotation by default is counter-clock wise according to right hand rule.

According to Rodrigues' Rotation Formula

R=I+sinθ[K]+(1cosθ)K2

where:

  • I is the identity matrix,
  • θ=30=π/6,
  • K is the skew-symmetric matrix of the unit vector v=13(1,1,1).

Compute the Skew-Symmetric Matrix K

The unit vector along (1,1,1) is:

v=13[111]

The skew-symmetric matrix K is:

K=[013131301313130]

Compute K2

K2=[231313132313131323]

Compute the Rotation Matrix

Using sin(30)=12 and cos(30)=32, we substitute:

R=I+sin(30)K+(1cos(30))K2

After computation, the rotation matrix is:

Mcomposite=[2+3313313132+33133133132+33]

4. Given eye point (0,2,2), center point (0,0,0), up vector (0,1,1), find the camera frame, the transformation matrix from world frame to camera frame. (ref: code assign0).

a=PeyePlook=(0,2,2)r=up×a=(4,0,0)u=a×r=(0,8,8)

a^=a||a||=(0,22,22)

r^=r||r||=(1,0,0)

u^=u||u||=(0,22,22)

Question-4

Please draw a, up, r, u vector on the below pictures, and specify which up you choose.

YcczYO