New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

IntroductionComputer Graphics

by: Abe Jones

IntroductionComputer Graphics CS 470

Marketplace > West Virginia University > ComputerScienence > CS 470 > IntroductionComputer Graphics
Abe Jones
GPA 3.77


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 42 page Class Notes was uploaded by Abe Jones on Saturday September 12, 2015. The Class Notes belongs to CS 470 at West Virginia University taught by Staff in Fall. Since its upload, it has received 6 views. For similar materials see /class/202775/cs-470-west-virginia-university in ComputerScienence at West Virginia University.

Similar to CS 470 at WVU

Popular in ComputerScienence


Reviews for IntroductionComputer Graphics


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/12/15
Computer Graphics CS 470 Computer Science and Electrical Engineering Dept West Virginia University 11th September 2007 39 Outline 0 Review 0 Lines and planes in af ne space 9 Lines and planes in Euclidean space 9 3D primitives 39 Abstract types 0 Vector magnitude and direction 0 Point Location 0 Space gt A set of objects gt Operations on members of that set gt Properties of the operations 0 Vector space gt Set vectors gt Operations familiar scalarvector multiplication vectorvector addition 9 Af ne space extension of vector space gt Set vectors and points gt Operations Vector space operations and pointvector addition pointpoint subtraction o Euclidean space extension of af ne space gt Set vectors and points gt Operations Inner product allows distances and angles to be measured 3 39z0 39 Concrete representations You are probably used to considering vector and points as equivalent The concepts are different but it is common to use the same representation for both structures 2 23929 39 Af ne space Lines Using the elements and operations of af ne space it is possible to de ne a line Pa P0 ad These are all valid operation in af ne space 0 ad scalar x vector a vector 9 P0 ad point vector a point a This is called the parametric form ofa line 0 Different values of the parameter 04 give different point on the line I 5720 Lines and planes in af ne space A ine space Lines 1 x Pa Pa P0 Old 0 Line no endpoints oz 6 oo oo 0 Ray one endpoint oz 6 0 oo 0 Line segment two endpoints oz 6 050051 fZO CS 470 West Virginia University Computer Graphics Lines and planes in af ne space A ine space Lines We may also de ne a line in terms of 2 points on the line 1306 QaR Q 1I Pa a When computing points on the line the equation can be rewritten as Pa aR l aQ Note that the operations involved are no longer de ned in af ne space This is a useful operation to have so we de ne it as a valid operation called af ne addition CS 470 West Virginia University x 11th September 2007 7 20 39 Af ne space Af ne addition Af ne addition can be de ned for more than 2 points P 041P1 OzzPZ ozP under the condition that a1azan1 Lines and planes in a ine space Af ne space Planes Recall from geometry that 3 noncollinear points de ne a plane In a Cine space a plane can be de ned as a direct extension of the parametric line Let P Q7 R be 3 noncollinear points Consider the line Sa joining point P and Q 5a aP l aQ 5a 0 Now construct a line T between any point S on that line and the point R CS 470 West Virginia University llth Septemberi20 07 9 2039 Lines and planes in a ine space Af ne space Planes P 5a Q The line T can be written as T S l l R Where 5a aP l aQ Substituting the equation for S into the equation for T we have HOW Mod 1 OOQ 1 MR Plugging in values for 04 gives points on the plane de ned by P Q R CS 470 West Virginia University Computer Graphics 11th Septemberaom 130 f 2039 39 Euclidean space Dot product Recall the dot product ab Zaibi llaHHbHcos0 i Euclidean space adds the notions of length and distance to the af ne space We will de ne the length of a vector u to be Hull W u and the distance between points P7 Q as HP We may normalize a vector b to obtain a new vector 21 Whose length is 1 b 3 T7llall 1 H H I n 20 Lines and planes in Euclidean space Euclidean space Dot product The dot product can be used to compute the angle between 2 vectors u v u V We can use the concepts of Euclidean space to obtain di erent forms of the line and plane de nitions 1 39x Pla Po Note that for all points P on the line de ned by P0 and d we have CS 470 West Virginia University 1 1th September 2007 12 f 20 Lines and planes inEuclidean space Euclidean space Dot product We can specify a plane by specifying one point P0 on the plane and a vector 11 perpendicular to the plane All points P on the plane de ned by P0 and n we have P P0n0 These representations of points and lines are called implicit They don t allow us to directly generate points on the lineplane they do allow us to test whether a given point is on the lineplane CS 470 West Virginia University 1 1th 39S eptemberZOW 13 r20 39 Euclidean space Cross product x Vx For vectors u uy and V vy the cross product is de ned by z Vz ltsz 7 uzvy 11 X V uzvx 7 uxvz uxvy 7 uyvx 12 my Lines and planes in Euclidean space Euclidean space Cross product VXU If u and v are not parallel then the vector 11 X v is orthogonal to u and v The length of the resulting vector is related to the angle between u and v by ugtltV llull V sin6 2 CS 470 West Vn ginia University Compute riGraplliic S lJl th September 2007 15 W20 39 Threedimensional primitives We have seen how to represent simple 3D objects lines and planes One challenge of computer graphics is representing complex real objects We will use the following approach 0 Represent objects as surfaces not solids 0 Store the coordinates of points on the surface 0 Approximate the surface using planar polygons 1620 gin Represent objects as surfaces not solids If the camera does not pass through objects and if objects never break apart we Will only ever see the surface This is only a visual representation the application programmer must devise techniques to prevent objects from intersecting Em m yfmis vp quot s i c w m 11th September 2007 17 20 3D primitives Store the coordinates of points on the surface The mathematical description of surfaces can become complex so we will work with points sampled from the surface Image credits Hughes Hoppe UW We don t require mathematical descriptions of every object we wish to render CS 470 39 39 39z 39 3 Computer Graphics Dmmk r Approximate the surface using planar polygons We are viewing the output of a raster device so if the polygons in the surface approximation have a projected size of much less than one pixel the resulting image will be a very good representation of the actual surface Image credits Henrik Jensen UCSD We will also see techniques for shading polygons which will give the impression geometric complexity 11th September 2007 1920 Threedimensional primitives Why triangles 0 Always planar 0 Always simple edges do not intersect 0 Always convex line between any 2 points is in triangle 0 It is easy to optimize the hardware for triangles O XE Valid mum Nonplanar quadrilateral 39 20 20 Computer Graphics CS 470 Computer Science and Electrical Engineering Dept West Virginia University 18th September 2006 39 Outline 0 Review 0 Rotation 9 Matrix concatenation 9 Transformations in OpenGL 39 Transformations 0 Point and vector representations can be distinguished by expressing them in homogeneous coordinates a The coordinates are dependent on the choice of frame The same point will have different homogeneous coordinates in different frames 0 We can use an af ne transformation matrix M to transform one frame into another 0 We can use an af ne transformation matrix MT to transform the coordinates of a point or vector in one frame into the coordinates in another frame a Af ne transformations are equivalent to changes in frame The nal result we can apply af ne transformations to points and vectors by multiplying their homogeneous representations by af ne matrices x H 317 2D Rotation Geometric derivation Rewrite in polar coordinates y x pcosng y psincb x pcos0 y psin0 x y Using the trig identities cos0 cos cos0 sin ngsin 0 sin0 cos sin0 sin cos0 gtlt Rewrite x y in terms of x y pcos cos07 psinngsinQ xcos07ysin0 y pcos sin0psin cos0xsin0ycos0 gtlt r 39 L 18th September 200 6 4177 G bmpx er quphiizs CS 470 Vi 39 2D Rotation Geometric derivation We can rewrite this system of equations xcos07ysin0 x y xsin0ycos0 in matrix form as x 7 cos 9 7 sin 9 x y 7 sin 9 cos 9 y This is equivalent to 3D rotation about the z aXis x cos 9 7 sin 9 0 x y sin 9 cos 9 0 y z 0 0 1 z I 39 5717 39 Rotation in homogeneous coordinates To rotate homogeneous points w 1 or vectors w 0 we use a 4 x 4 matrix x cos 9 7 sin 9 0 0 x y sin 9 cos 9 0 0 y z 7 0 0 1 0 z w 0 0 0 1 w This can also be derived by converting frames I V 617 39 Rotation in homogeneous coordinates Rotation about the XaXis x 1 0 0 0 x y 7 0 cos 9 7 sin 9 0 y 2 7 0 sin 9 cos 9 0 z w 0 0 0 1 w Rotation about the yaXis x cos 9 0 sin 9 0 x y 7 0 1 0 0 y 2 7 7 sin 9 0 cos 9 0 z w 0 0 0 1 w I 39 717 39 MatriX concatenation sequences of transformations We can combine af ne transformations by multiplying matrices If A7 B and C are transformation matrices we can apply the sequence to a point p by multiplying q CBAp this is equivalent to applying the matrixvector multiplication 3 times q CBAp or computing the matrixmatrix product M CBA and then transforming the point qMp 8717 Matrix concatenation Example rotation about a xed point Suppose we want to rotate a cube about its own center 0 Recall that the rotation transformation rotates points about the coordinate frame origin 0 The origin is a xed point of the transform it remains unchanged after transformation CS 470 W est Virginia University Computer Graphics 18th September 32006 9 17 Matrix concatenation Example rotation about a xed point We can rotate the cube about its own center by combining 3 transformations I y y y Pf 39 o P I gt gt gt x x x x Z 2 Z 0 Translate the center of the cube to the origin T pf Y 0 Apply the desired rotation R 0 Translate the center of the cube back to its original location Tpf o This can be done with a single matrix M TpfRT pf CS 470 West Virginia University Computer 18th September 2006 10 l7 Two ways to combine rotation and translation fa a Rotate then translate left 0 Translate then rotate right Just keep in mind that rotation occurs about the origin of the current frame 39 Transformations in OpenGL a Part of the OpenGL state is the current transformation matrix we ll denote this by C o OpenGL commands load or postmultiply C by a given matrix M gt glLoadMatrixf C lt7 M gt glMultMatrixf C lt7 CM 0 We can also reset C to an identity matrix gt glLoadIdentity 2 C lt7 I c There are also commands to postmultiply C by speci c types of transformation matrices which OpenGL will compute for us gt ngranslatef C lt7 CT gt ngcalefCltiCS gt glRotatefCltiCR I 1317 39 Transformations in OpenGL o ngranslatef GLfloat x GLfloat y GLfloat z gt Form homogeneous matrix for translation by x7 y7 z and postmultiply C 0 ngcalef GLfloat sx GLfloat sy GLfloat 52 gt Form homogeneous matrix for sealing by factors 3x7 531 sz and postmultiply C o glRotatef GLfloat angle GLfloat x GLfloat y GLfloat z gt Form homogeneous matrix for rotation by angle degrees about the axis xyz and postmultiply C gt glRotatef a l Of O Of will rotate about the xaxis gt glRotatef a O Of l Of 0 Of will rotate about the yaxis gt glRotatef a O Of O Of 1 Of will rotate about the zaxis gt Can also rotate about an arbitrary axis 00f I 15 17 39 Transformations in OpenGL Keep in mind that these command are performing postmultiplication the last transformation command is the rst one applied glMatriXMode GLMODELVIEW glLoadIdentityO ngranslatef X y Z glRotate450f 00f 00f 10f ngranslatef x y Z O C lt I 0 C I o C lt CTxyz O C Txyz 0 CltCR 0 CTxyzR 0 C lt CT7x7 7y 72 0 C Txy7 zRT7x7 7y 72 I 1717 Computer Graphics CS 470 Computer Science and Electrical Engineering Dept West Virginia University 26th September 2007 39 Outline 0 Planar re ections e Planar shadows Re ection matrix We can use a matrix to render an object re ected in a planar mirror y0 camem position qx qy If the model vertices are q then the re ected vertices are q S l l lq Where Sl l l is the scale matrix 1 0 0 0 0 71 0 0 3077171 0 0 1 0 0 0 0 1 CS 470 W Virginia University V v H 739 39 26th September 2007 3 8 39 Re ection matrix For re ections in some other plane transform that plane to the y0 plane re ect and transform back If the plane is de ned by a point p and normal 11 0 Translate the plane to the origin T 717 o Rotate so that n is parallel with the yaXis R09 V gt 6 cos 1nez 0 Scale about the yaXis by factor 1 Sl l l 0 Apply inverse rotation R 10V R70v 0 Translate back to original position T 17p Tp The complete transformation for a plane in general position is TpR707VS177171R07VT pq I L 39 2H8 Planar shadows Shadow matrix We can use a matrix to form the shadow of an object cast on a plane YA light Ix ly veltex vx vy lyrvy LIX vx shadow px o IX 7 px4gt o Ix 1y light position 0 vmvy object vertices o pxpy shadow vertices CS 470 W irginia University 7 H 7 39 26th September 2007 5 8 39 Shadow matrix We wish to write an equation for shadow vertices in terms of object vertices p MV By similar triangles we have Ix 17 7 Ix 7 Vx y y Vy Rearranging this relation we can write an equation for 7x in terms of Vx px lyvx 7 lxvy 1y Vy 39 Shadow matrix Using the same analysis we can get an equation for 7 in terms of vz lyvzi sz p2 7 y Vy Since we are computing the shadow for the y0 plane py 0 Consider the equation Vx lyvx 7 XV Vy 7 0 0 71 y V2 7 lyvz 7 sz i0 1 0 lyiili i ly Vy i Note this is not an af ne transformation I 7 8 39 Shadow matrix After the perspective division process We have MV iiiaiiiii m t J 1 lyvx ilxvy 1y Vy So M is the shadow projection matrix lyvx 7 XV 0 H l v 71v 1sz 7 zvy l y y y Vy 1y 71x 0 o 0 0 0 0 M o it ty 0 o 71 1y


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.