Tutorial2 Slides

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Tutorial 2

Essential Math for


Games I

Slides prepared by Dr. Aish and Milena Novakovic


Find the coordinates of the corners of the
given 3D box, whose center is at origin.
z

A
8 units D
G
4 units
H y
F (0,0,0)
B

E C
6 units
x
Solution
z
The center of the rectangular box is at the origin

A=(-4,3,2)
A B=(-4,3,-2)
8 units D C=(4,3,-2)
G
4 units D=(4,3,2)
E=(4,-3,-2)
H (0,0,0) y
F F=(4,-3,2)
B G=(-4,-3,2)
H=(-4,-3,-2)
E C
6 units
x
Find the coordinates of the corners of the
given 3D box, whose center is at origin.

A
8 units D
G
4 units
(0,0,0)
x
H
F
B

E C

y 6 units
z
Parametric equation of a line

𝒑𝟐 = 𝒑𝟏 + 𝒕𝒅
Another point on Line = Starting Point + Scalar Distance * Direction Vector

1.4.1.4. Given a starting point of (0,0) and a direction of (0.7071, 0.7071),


compute a point on the line at (a) 2 steps, (b) 3 steps, and (c) 10 steps.
Solutions
𝒑𝟐 = 𝒑𝟏 + 𝒕𝒅

p# = (0,0) d = (0.7071, 0.7071)

(a) 2 steps (t = 2) (b) 3 steps (t = 3) (c) 10 steps (t = 10)

𝑝$ = (0,0) + 2(0.7071, 𝑝$ = (0,0) + 3(0.7071, 𝑝$ = (0,0) + 10(0.7071,


0.7071) 0.7071) 0.7071)

𝑝$ = (1.414, 1.414) 𝑝$ = (2.121, 2.121) 𝑝$ = (7.071, 7.071)


Normal form of a plane
The normal on the plane 𝑛 = 𝑎, 𝑏, 𝑐
The point 𝑝⃗ = 𝑥% , 𝑦% , 𝑧%

The equation of plane:


𝑎𝑥 + 𝑏𝑦 + 𝑐𝑧 + 𝑑 = 0
Here, 𝑑 = −(𝑎𝑥% + 𝑏𝑦% + 𝑐𝑧% )
(a) Find the equation of the plane if the normal vector is 1,0, 0 given and
2,2,2 is passing through the plane.
(b) Find the equation of the plane if the normal vector is 1,0, 1 given and
2,2,5 is passing through the plane.
Solutions
𝑑 = −(𝑎𝑥% + 𝑏𝑦% + 𝑐𝑧% )

(a) Find the equation of the plane if the normal vector is 𝟏, 𝟎, 𝟎 given and
𝟐, 𝟐, 𝟐 is passing through the plane.
d = - (1(2) + 0(2) + 0(2))
d = -2

(a) Find the equation of the plane if the normal vector is 𝟏, 𝟎, 𝟏 given and
𝟐, 𝟐, 𝟓 is passing through the plane.
d = - (1(2) + 0(2) + 1(5))
d = -7
Do these circles collide?
𝑑 𝑑 𝑑

𝑟! 𝑟!
𝑟" 𝑟" 𝑟! 𝑟"

No collision Collision! Collision!


𝑑 > 𝑟! + 𝑟" 𝑑 = 𝑟! + 𝑟" 𝑑 < 𝑟! + 𝑟"

d= 𝑥$ − 𝑥# $ + 𝑦$ − 𝑦# $

1. Consider two circles with radii 12 units and 16 units. Do they collide if
their centers are in (a) 15, 7 and 23, 21 (b) 15, 7 and (18,19).
Solutions
d= 𝑥$ − 𝑥# $ + 𝑦$ − 𝑦# $

(a) 𝟏𝟓, 𝟕 and 𝟐𝟑, 𝟐𝟏 (b) 𝟏𝟓, 𝟕 and (18,19).

d = 15 − 23 $ + 7 − 21 $ d = 15 − 18 $ + 7 − 19 $

d = 16.125 d = 12.369

r = 12 + 16 r = 28
r = 28
r>d
r>d They collide!
They collide!

You might also like