Download presentation
Presentation is loading. Please wait.
1
3D Geometry for Computer Graphics Class 1
2
General Office hour: Sunday 11:00 – 12:00 in Schreiber 002 (contact in advance) Webpage with the slides: http://www.cs.tau.ac.il/~sorkine/courses/cg/cg2005/ http://www.cs.tau.ac.il/~sorkine/courses/cg/cg2005/ E-mail: sorkine@tau.ac.ilsorkine@tau.ac.il
3
The plan today Basic linear algebra and Analytical geometry
4
Why??
5
We represent objects using mainly linear primitives: points lines, segments planes, polygons Need to know how to compute distances, transformations, projections…
6
Basic definitions Points specify location in space (or in the plane). Vectors have magnitude and direction (like velocity). Points Vectors
7
Point + vector = point
8
vector + vector = vector Parallelogram rule
9
point - point = vector A B B – A A B A – B
10
point + point: not defined!!
11
Map points to vectors If we have a coordinate system with origin at point O We can define correspondence between points and vectors:
12
Inner (dot) product Defined for vectors: L v w Projection of w onto v
13
Dot product in coordinates (2D) v w xvxv yvyv xwxw ywyw x y O
14
Perpendicular vectors (2D) v vv
15
Parametric equation of a line p0p0 v t > 0 t < 0 t = 0
16
Parametric equation of a ray p0p0 v t > 0 t = 0
17
Distance between two points B A xBxB yByB xAxA yAyA x y O
18
Distance between point and line Find a point q’ such that (q q’) v dist(q, l) = || q q’ || p0p0 v q q’ = p 0 +tv l
19
Easy geometric interpretation p0p0 v q q’ l L
20
Distance between point and line – also works in 3D! The parametric representation of the line is coordinates-independent v and p 0 and the checked point q can be in 2D or in 3D or in any dimension…
21
Implicit equation of a line in 2D x y Ax+By+C > 0 Ax+By+C < 0 Ax+By+C = 0
22
Line-segment intersection x y Ax+By+C > 0 Ax+By+C < 0 Q 1 (x 1, y 1 ) Q 2 (x 2, y 2 )
23
Representation of a plane in 3D space A plane is defined by a normal n and one point in the plane p 0. A point q belongs to the plane = 0 The normal n is perpendicular to all vectors in the plane n p0p0 q
24
Distance between point and plane Project the point onto the plane in the direction of the normal: dist(q, ) = ||q’ – q|| n p0p0 q’ q
25
Distance between point and plane n p0p0 q’ q
26
Implicit representation of planes in 3D (x, y, z) are coordinates of a point on the plane (A, B, C) are the coordinates of a normal vector to the plane Ax+By+Cz+D > 0 Ax+By+Cz+D < 0 Ax+By+Cz+D = 0
27
Distance between two lines in 3D p1p1 p2p2 u v d The distance is attained between two points q 1 and q 2 so that (q 1 – q 2 ) u and (q 1 – q 2 ) v q1q1 q2q2 l1l1 l2l2
28
Distance between two lines in 3D p1p1 p2p2 u v d q1q1 q2q2 l1l1 l2l2
29
p1p1 p2p2 u v d q1q1 q2q2 l1l1 l2l2
30
p1p1 p2p2 u v d q1q1 q2q2 l1l1 l2l2
31
Barycentric coordinates (2D) Define a point’s position relatively to some fixed points. P = A + B + C, where A, B, C are not on one line, and , , R. ( , , ) are called Barycentric coordinates of P with respect to A, B, C (unique!) If P is inside the triangle, then + + =1, , , > 0 A B C P
32
Barycentric coordinates (2D) A B C P
33
Example of usage: warping
34
Tagret A B C We take the barycentric coordinates , , of P’ with respect to A’, B’, C’. Color( P ) = Color( A + B + C )
35
See you next time!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.