230 likes | 311 Views
SE 313 – Computer Graphics. Lecture 3: Analytical Geometry and Linear Algebra Lecturer: Gazihan Alankuş. Please look at the last three slides for assignments (marked with TODO ). Quiz. Turn off monitors Take out a piece of paper and a pen/pencil 5 minutes. Our Goal.
E N D
SE 313 – Computer Graphics Lecture 3: Analytical Geometry and Linear Algebra Lecturer: GazihanAlankuş Please look at the last three slides for assignments (marked with TODO)
Quiz • Turn off monitors • Take out a piece of paper and a pen/pencil • 5 minutes
Our Goal • Remember basic concepts in analytical geometry and learn about how they are applied in linear algebra and in computer graphics
Coordinate Frame • An origin point • Three axes (x, y, z) • that are perpendicular to each other • that are ordered by the right hand rule (x-thumb, y-index finger, z-middle finger)
Point • Location in space • Coordinates (x, y, z)
Displacement between two points • Vector = Point – Point • Example: “North-east, 5 meters” • No position, only direction. • If you want to, you can draw it starting from any position.
Representing points and vectors • Both of them are represented with three scalar values for the x, y and z axes. • They mean different things • Point – precise location in space • Vector – precise direction, no location
Operations • Point addition • Point subtraction • Vector addition • Vector subtraction
Operations • Point addition • Point subtraction -> Vector • Vector addition -> Vector • Vector subtraction -> Vector • Details are presented on the board, check your book or assigned online readings if you missed it.
Different Coordinate Frames • In computer graphics sometimes we use multiple reference coordinate frames • World coordinates, character coordinates, camera coordinates, etc. • The same geometrical point or vector is represented with different values in different coordinate frames. • The values depend on the coordinate frame being used.
More Simple Operations • Point – vector addition • Point scaling • Vector scaling
More Simple Operations • Point – vector addition -> point • Point scaling -> point • Vector scaling -> vector • Details are presented on the board, check your book or assigned online readings if you missed it.
Vectors have length • How much you would travel if you followed the vector • Unit vectors: a vector in the same direction, but with a length of 1 • Direction without magnitude
More Interesting Operations • Vector dot product • Vector cross product
More Interesting Operations • Vector dot product -> scalar • Vector cross product -> vector
Dot product • Gives a number for two vectors • Greatest when vectors are in the same direction • Zero when vectors are perpendicular • Negative when vectors are opposing • http://www.falstad.com/dotproduct/
Properties • Dot product two perpendicular vectors, you get zero • Dot product a vector with itself, you get the square of its magnitude • Can be used to calculate projections
Cross product • Gives a new vector for two vectors • (don’t try to memorize, use computers) • Perpendicular to the two vectors according to the right hand rule • Maximum when vectors are perpendicular • Zero when vectors are the same or opposite directions • http://physics.syr.edu/courses/java-suite/crosspro.html
Properties • (opposite direction)
Angle between two vectors • Can find the angle using atan(y/x) • Watch out for the sign • Use atan2(y, x)
Lab assignment • Part 1 • Open up Blender, create a cone. Go to edit mode. Make sure everything is selected using Select->(De)select All. • Use View->Properties to show the properties pane. You will see the median location of all selected points there. Set it to 0, 0, -2 so that the tip of the cone is at the reference point. • Go back to object mode. Make the cone red. Duplicate the cone, make that duplicate blue. You should have one red and one blue cone. • Create a sphere in origin and make it white. • Part 2 • Locate the two cones so that the vectors from the origin to the cones make an angle between 0-90 degrees. • Create two cylinders, locate and rotate them so that they look like the stems of the vectors. Color them the same as the cones. • Rotate the cones accordingly. The end result should look like two vectors with an angle between 0-90 degrees. • Part 3 • Convert the properties pane on the right to be a Python console. Create two vectors using a code like this. The values should come from the locations of the cones. • v1 = Vector([1.2, 1.3, -1.4]) • v2 = Vector([5.5, 1.4, -3.4]) • Calculate the cross product like this: • c=v1.cross(v2) • Normalize the vector using: • c.normalize() • print(c) • Draw a third vector starting from the origin and representing the normalized cross product. Make it green.
TODO: Homework 3.a (video) • Re-watch the Blender intro to modeling video here: • http://cgcookie.com/blender/2010/08/31/blender-intro-to-modeling/ • There will be quiz about it next week.
TODO: Homework 3.b (deliverable) • Start with a cube and use the extrude tool to create the first letter of your name. Feel free to make it pretty. • Submit the rendered image and the .blend file, just like you did last week.