0% found this document useful (0 votes)
7 views

Cs3vr16 Graphics 4 Tutorial(2)

Uploaded by

fatimabuhari2014
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Cs3vr16 Graphics 4 Tutorial(2)

Uploaded by

fatimabuhari2014
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

CS3VR16 : Graphics 4 - Tutorial

Graphics 4 -Tutorial – practice building model

p1 RJM 06/11/23 CS3VR16 – Virtual Reality – Graphics 4 -


Tutorial
Introduction
A regular exam topic is building a model from cubes
suitably transformed
Remember, in 3D we transform xc,yc,zc to xn,yn,zn by

Transforms used here are scale, move and skew


Let us model a sofa

p2 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial


© Prof Richard Mitchell 2023
What about modelling this
sofa?
Need transformed cuboids for
2 Legs
Seat
2 Arms
Back
What operations needed ?
z (don’t include numbers)
x
Assume 1*1*1 cube,
y 0,0,0 at base centre

p3 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial


© Prof Richard Mitchell 2023
Details
240 340
-300 300
980
-
100
186
530 480
z z 440 z
x
x y
y 0
-200 200 -250 250
Seat 400*600*40, at height 440
Legs 400*50*440, moved left/right, so aligned at
±300
Back 100*600*500, skewed, on top of seat
Arms 300*50*50, skewed,
p4 RJM 06/11/23 on top
CS3VR16 – Graphics of seat and moved
4 - Tutorial
© Prof Richard Mitchell 2023
On checking correct
z +0.5,+0.5
x ,1
-0.5,- y
0.5,0
Find transformation matrix for a cube
Can check if correct by testing position to
which opposite corners are transformed.
In exam, may be asked to check other
corners, or the middle of surfaces.
Note cube may have different size/origin.

p5 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial


© Prof Richard Mitchell 2023
Testing In MatLab
I tested the answer in MatLab
Generating matrices, by for instance
>> s=[100,0,0,0;0,600,0,0;0,0,500,0;0,0,0,1];
And all corners of a cube are defined by
-0.5 0.5 0.5 -0.5 -0.5 0.5 0.5 -0.5
-0.5 -0.5 0.5 0.5 0.5 0.5 -0.5 -0.5
0 0 0 0 1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
Then I can test all corners

p6 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial


© Prof Richard Mitchell 2023
‘Seat’
Seat 400*600*40, at height 440
Scale by and move by
Show -0.5,-0.5,0 transformed to -200,-300,
440
Check +0.5,+0.5,1
240suitably transformed
340 -300 300
980
-
100
186
530 480
z 440 z
x y
0
-200 200 -250 250
p7 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial
© Prof Richard Mitchell 2023
Right leg
Legs 400*50*440, moved left/right, so aligned at
300
Scale by and move by
Show -0.5,-0.5,0 transformed to -200,-250, 0
Check +0.5,+0.5,1 suitably340
240 transformed
-300 300
980
-
100
186
530 480
z 440 z
x y
0
-200 200 -250 250
p8 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial
© Prof Richard Mitchell 2023
skewing
Same skewing matrix works for back and arms

240 340 Back, as z rises by


500, x increase by
980
-
100 Arm, as z rises by 50, x
186
increase by
530 480
z 440 So skew matrix is
x
0
-200 200

p9 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial


© Prof Richard Mitchell 2023
Skew
Back, as z rises by 500, x increase by 140

Arm, as z rises by 50, x increase by 14

Do want x = x + 14/50 z = x + 0.28z

So >> k=

p10 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial


© Prof Richard Mitchell 2023
Back
Back 100*600*500, skewed, on top of seat
Scale by ,skew and move by
Show -0.5,-0.5,0 transformed to 100, 250, 480
Check +0.5,+0.5,1 suitably transformed
240 340 -300 300
980
-
100
186
530 480
z 440 z
x y
0
-200 200 -250 250
p11 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial
© Prof Richard Mitchell 2023
Right arm
Arm 300*50*50, skewed, on top of seat suitably
Scale by ,skew and move by
Show -0.5,-0.5,0 transformed to -200, 250, 480
Check +0.5,+0.5,1 suitably transformed
240 340 -300 300
980
-
100
186
530 480
z 440 z
x y
0
-200 200 -250 250
p12 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial
© Prof Richard Mitchell 2023
Transforming whole sofa

z
x
z
y
x
How draw sofa at different
y size, position and angle?
How find, say, middle of the
back seat of such a
transformed sofa?
p13 RJM 06/11/23 CS3VR16 – Graphics 4 - Tutorial
© Prof Richard Mitchell 2023

You might also like