today: circles, ellipses, lines in 3d, (hyper)planes and

44
Graphics (INFOGR), 2018-19, Block IV, lecture 3 Deb Panja Today: Circles, ellipses, lines in 3D, (hyper)planes and cross product Welcome 1

Upload: others

Post on 25-Dec-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Graphics (INFOGR), 2018-19, Block IV, lecture 3

Deb Panja

Today: Circles, ellipses, lines in 3D,(hyper)planes and cross product

Welcome

1

Page 2: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Today

• Circles, ellipses and shooting rays

• Lines and planes in 3D

• Cross products of vectors

• (Hyper)planes and normals

2

Page 3: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Circles, ellipses and shooting rays

3

Page 4: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Equations of circles

• Circle: (x− h)2 + (y − k)2 = r2

(h, k): location of the centre

4

Page 5: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Equations of circles and ellipses

• Circle: (x− h)2 + (y − k)2 = r2

(h, k): location of the centre

• Ellipse: (x− h)2

a2+

(y − k)2

b2= 1

(h, k): location of the centre

a: semi-major axis, b: semi-minor axis

5

Page 6: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Equations of circles and ellipses

• Circle: (x− h)2 + (y − k)2 = r2

(h, k): location of the centre

• Ellipse: (x− h)2

a2+

(y − k)2

b2= 1

(h, k): location of the centre

a: semi-major axis, b: semi-minor axis

(both of the above are implicit forms)

6

Page 7: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Circular co-ordinate system

•[xy

]=

[hk

]+ r ur; ur =?

7

Page 8: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Circular co-ordinate system

•[xy

]=

[hk

]+ r ur; ur =

[cos θsin θ

]; uθ =?

8

Page 9: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Circular co-ordinate system

•[xy

]=

[hk

]+ r ur; ur =

[cos θsin θ

]; uθ =

[− sin θcos θ

]

9

Page 10: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Circular co-ordinate system

•[xy

]=

[hk

]+ r ur; ur =

[cos θsin θ

]; uθ =

[− sin θcos θ

]• Given (h, k) and r, P is described by θ alone:

x = h+ r cos θ, y = k + r sin θ (parametric form)

10

Page 11: Today: Circles, ellipses, lines in 3D, (hyper)planes and

The circular co-ordinate system

•[xy

]=

[hk

]+ r ur; ur =

[cos θsin θ

]; uθ =

[− sin θcos θ

]• Given (h, k) and r, P is described by θ alone:

x = h+ r cos θ, y = k + r sin θ (parametric form)

• ur unit normal vector; uθ unit tangent vector to the circle at P

11

Page 12: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Shooting rays at a circle

• Given: Eye at (x0, y0), ray along v, circle centre at (h, k), radius r

Q. Find locations of P1 and P2

12

Page 13: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Shooting rays at a circle

• Given: Eye at (x0, y0), ray along v, circle centre at (h, k), radius r

Q. Find locations of P1 and P2

A. Shoot a ray from E along v, intersect circle at P1 and P2

13

Page 14: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Shooting rays at a circle

• Given: E at (x0, y0), ray along v, circle centre at (h, k), radius r[xy

]=

[x0y0

]+ l

[vxvy

]; (x− h)2 + (y − k)2 = r2

14

Page 15: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Shooting rays at a circle

• Given: E at (x0, y0), ray along v, circle centre at (h, k), radius r[xy

]=

[x0y0

]+ l

[vxvy

]; (x− h)2 + (y − k)2 = r2

⇒ quadratic equation in l: al2 + bl + c = 0

15

Page 16: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Shooting rays at a circle

• Given: E at (x0, y0), ray along v, circle centre at (h, k), radius r[xy

]=

[x0y0

]+ l

[vxvy

]; (x− h)2 + (y − k)2 = r2

⇒ quadratic equation in l: al2 + bl + c = 0

⇒ l = − b

2a±√b2 − 4ac

2a

16

Page 17: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Shooting rays at a circle

• Given: E at (x0, y0), ray along v, circle centre at (h, k), radius r[xy

]=

[x0y0

]+ l

[vxvy

]; (x− h)2 + (y − k)2 = r2

⇒ quadratic equation in l: al2+bl+c = 0 ⇒ l = − b

2a±√b2 − 4ac

2a⇒ (i) b2− 4ac > 0: (P1,P2); (ii) b2− 4ac = 0: P1 = P2 (tangent ray);

(iii) b2 − 4ac < 0: no intersection; ⇒ (θ1, θ2)-values for P1 and P2

17

Page 18: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Shooting rays at a circle

• Given: E at (x0, y0), ray along v, circle centre at (h, k), radius r[xy

]=

[x0y0

]+ l

[vxvy

]; (x− h)2 + (y − k)2 = r2

⇒ quadratic equation in l: al2+bl+c = 0 ⇒ l = − b

2a±√b2 − 4ac

2a⇒ (i) b2− 4ac > 0: (P1,P2); (ii) b2− 4ac = 0: P1 = P2 (tangent ray);

(iii) b2 − 4ac < 0: no intersection; ⇒ (θ1, θ2)-values for P1 and P2

P2 will not be visible to the eye!

18

Page 19: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Ingredients for 3D, and recap

• Will work in 3D, Cartesian co-ordinates: (x, y, z) reference directions

− in Cartesian co-ordinates x, y and z as basis vectors

• A point P: (x, y, z), a vector ~v =

vxvyvz

− will use vector

xyz

to reach point (x, y, z) from the origin

19

Page 20: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Lines and planes in 3D

20

Page 21: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Shooting a ray for a line in 3D

xyz

=

x0y0z0

+ lv =

x0y0z0

+ l

vxvyvz

(parametric form)

• x− x0vx

=y − y0vy

=z − z0vz

(= l) [equivalent slope-intercept form]

21

Page 22: Today: Circles, ellipses, lines in 3D, (hyper)planes and

A plane in 3D

Given: n, normal to the plane, and (x0, y0, z0) on the plane

Q. What is the equation of this plane?

(uses: storing a plane in the memory, distance to the plane. . .)

22

Page 23: Today: Circles, ellipses, lines in 3D, (hyper)planes and

A plane in 3D

Given: n, normal to the plane, and (x0, y0, z0) on the plane

Q. What is the equation of this plane?

A. Plane equation: (x− x0)nx + (y − y0)ny + (z − z0)nz = 0

23

Page 24: Today: Circles, ellipses, lines in 3D, (hyper)planes and

A plane in 3D

• Plane equation: (x− x0)nx + (y − y0)ny + (z − z0)nz = 0

nxx+ nyy + nzz − (nxx0 + nyy0 + nzz0) = 0, or

Ax+By + Cz +D = 0︸ ︷︷ ︸implicit form

(recall line in 2D form Ax+By + C = 0)

24

Page 25: Today: Circles, ellipses, lines in 3D, (hyper)planes and

A plane in 3D

• Plane equation: (x− x0)nx + (y − y0)ny + (z − z0)nz = 0

nxx+ nyy + nzz − (nxx0 + nyy0 + nzz0) = 0, or

Ax+By + Cz +D = 0︸ ︷︷ ︸implicit form

(recall line in 2D form Ax+By + C = 0)

• A plane divides the 3D space into two:

for one Ax+By + Cz +D > 0, for the other Ax+By + Cz +D < 0

25

Page 26: Today: Circles, ellipses, lines in 3D, (hyper)planes and

A plane in 3D

• Plane equation: (x− x0)nx + (y − y0)ny + (z − z0)nz = 0

nxx+ nyy + nzz − (nxx0 + nyy0 + nzz0) = 0, or

Ax+By + Cz +D = 0︸ ︷︷ ︸implicit form

(recall line in 2D form Ax+By + C = 0)

• A plane divides the 3D space into two:

for one Ax+By + Cz +D > 0, for the other Ax+By + Cz +D < 0

• Similarly a hyperplane also divides the space into two

26

Page 27: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross products of vectors

27

Page 28: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product of vectors

Q. Why?

28

Page 29: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product of vectors

Q. Why?

A. Because it allows us to easily switch between planes and their normals

29

Page 30: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product of two vectors

• ~u =

uxuyuz

; ~v =

vxvyvz

~w = ~u× ~v =

uyvz − uzvyuzvx − uxvzuxvy − uyvx

: a vector

~u× ~v = −~v × ~u

30

Page 31: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product of two vectors

• ~u =

uxuyuz

; ~v =

vxvyvz

~w = ~u× ~v =

uyvz − uzvyuzvx − uxvzuxvy − uyvx

: a vector

~u× ~v = −~v × ~u

• Geometric interpretation:

~w ⊥ (~u,~v); ~w · ~u =?

31

Page 32: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product of two vectors

• ~u =

uxuyuz

; ~v =

vxvyvz

~w = ~u× ~v =

uyvz − uzvyuzvx − uxvzuxvy − uyvx

: a vector

~u× ~v = −~v × ~u

• Geometric interpretation:

~w ⊥ (~u,~v); ~w · ~u = ~w · ~v = 0

||~w|| = ||~u|| ||~v|| sin θ

32

Page 33: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product of two vectors

• ~u =

uxuyuz

; ~v =

vxvyvz

~w = ~u× ~v =

uyvz − uzvyuzvx − uxvzuxvy − uyvx

: a vector

~u× ~v = −~v × ~u

• Geometric interpretation:

~w ⊥ (~u,~v); ~w · ~u = ~w · ~v = 0

||~w|| = ||~u|| ||~v|| sin θ~u and ~v are parallel; ~w = ~u× ~v =?

33

Page 34: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product of two vectors

• ~u =

uxuyuz

; ~v =

vxvyvz

~w = ~u× ~v =

uyvz − uzvyuzvx − uxvzuxvy − uyvx

: a vector

~u× ~v = −~v × ~u

• Geometric interpretation:

~w ⊥ (~u,~v); ~w · ~u = ~w · ~v = 0

||~w|| = ||~u|| ||~v|| sin θ~u and ~v are parallel; ~w = ~u× ~v = 0

34

Page 35: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product and handedness of a co-ordinate system

• Right-handed co-ordinate system: x× y = z, y × z = x, z × x = y

i.e., (x× y) · z > 0 etc.

(this is what we will use)

35

Page 36: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Cross product and handedness of a co-ordinate system

• Right-handed co-ordinate system: x× y = z, y × z = x, z × x = y

i.e., (x× y) · z > 0 etc.

(this is what we will use)

• Left-handed co-ordinate system: x× y = −z, y × z = −x, z × x = −yi.e., (x× y) · z < 0 etc.

36

Page 37: Today: Circles, ellipses, lines in 3D, (hyper)planes and

(Hyper)planes and normals

37

Page 38: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Revisit: (hyper)planes and normals

• Plane equation Ax+By + Cz +D = 0 (implicit form)

like line in 2D, normal n || ±

ABC

likewise, (shortest) distance from

the origin is|D|√

A2 +B2 + C2

(similarly for hyperplanes)

38

Page 39: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Revisit: (hyper)planes and normals

• Plane equation Ax+By + Cz +D = 0 (implicit form)

like line in 2D, normal n || ±

ABC

likewise, (shortest) distance from

the origin is|D|√

A2 +B2 + C2

(similarly for hyperplanes)

• Plane using two (planar) vectors (parametric form) xyz

=

x0y0z0

+ lu+ tv

(similarly for hyperplanes)

39

Page 40: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Revisit: (hyper)planes and normals

• Plane using two (planar) vectors (parametric form) xyz

=

x0y0z0

+ lu+ tv

(similarly for hyperplanes)

n || u× v Q. Given ~u and ~v on a plane can you calculate n?

40

Page 41: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Revisit: (hyper)planes and normals

• Plane using two (planar) vectors (parametric form) xyz

=

x0y0z0

+ lu+ tv

(similarly for hyperplanes)

n || u× v A. Given ~u and ~v on a plane n = ~u× ~v/||~u× ~v||for u ⊥ v, (u, v, n) form a right-handed co-ordinate system

in that case, normal n, tangent u, bitangent v

41

Page 42: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Summary: circles, ellipses, (hyper)planes and cross product

• Circles, ellipses and shooting rays at them

• Shooting rays as a line in 3D

− equations: parametric and implicit-like forms

• Equation of a plane using the normal vector

• Cross product, left- and right-handed co-ordinate systems

− implicit and parametric equations of a plane

− tangent and bitangent vectors

42

Page 43: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Summary: circles, ellipses, (hyper)planes and cross product

• Circles, ellipses and shooting rays at them

• Shooting rays as a line in 3D

− equations: parametric and implicit-like forms

• Equation of a plane using the normal vector

• Cross product, left- and right-handed co-ordinate systems

− implicit and parametric equations of a plane

− tangent and bitangent vectors

• Next class: primitives (continued) and projections in 3D

43

Page 44: Today: Circles, ellipses, lines in 3D, (hyper)planes and

Finally, references

• Book chapter 2: Miscellaneous Math

− Sec. 2.2, Sec. 2.4.4, 2.4.6-2.4.7

− Sec. 2.5, the relevant parts for 3D

44