Download presentation
Presentation is loading. Please wait.
1
Computer Graphics Recitation 1
2
General Office hour: Sunday 16:00 – 17:00 in Schreiber 002 Webpage with the slides: http://www.cs.tau.ac.il/~sorkine/courses/cg/ http://www.cs.tau.ac.il/~sorkine/courses/cg/ E-mail: sorkine@tau.ac.ilsorkine@tau.ac.il Short home assignments will be given from time to time
3
The plan today Basic linear algebra and Analytical geometry
4
Why?? We represent objects using mainly linear primitives: points lines, segments planes, polygons Need to know how to compute distances, transformations…
5
Basic definitions Points specify location in space (or in the plane). Vectors have magnitude and direction (like velocity). Points Vectors
6
Point + vector = point
7
vector + vector = vector Parallelogram rule
8
point - point = vector A B B – A A B A – B
9
point + point: not defined!!
10
Map points to vectors If we have a coordinate system with origin at point O We can define correspondence between points and vectors:
11
Inner (dot) product Defined for vectors: L v w
12
Dot product in coordinates v w xvxv yvyv xwxw ywyw x y O
13
Perpendicular vectors v vv
14
Parametric equation of a line P0P0 v t > 0 t < 0 t = 0
15
Parametric equation of a ray P0P0 v
16
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 The 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
Example of usage: warping
32
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, , , [0, 1], + + = 1 A B C P
33
Barycentric coordinates (2D) A B C P
34
Example of usage: warping 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
© 2025 SlidePlayer.com. Inc.
All rights reserved.