Slide 1AdminDemoMathematical Foundations3D GeometryVector SpacesVectors And PointsAffine SpacesSlide 9Affine Lines: An AsideDot ProductCross ProductLinear TransformationsMatricesSlide 15Matrix Transformations3D Scene Representation3D PointSlide 193D VectorSlide 21Slide 223D Line SegmentSlide 243D Ray3D Line3D PlaneSlide 283D Polygon3D SphereDisplay TechnologiesDisplay Technologies: CRTsSlide 33Slide 34Slide 35Slide 36Display Technology: Color CRTsSlide 38Display Technology: Raster CRTsCRTs – OverviewSlide 41Display Technology: LCDsSlide 43Slide 44Display Technology: PlasmaDisplay TechnologyDisplay Technology: DMDsSlide 48Display Technologies: Organic LED ArraysSlide 50Slide 51FramebuffersCS 445: Introduction to Computer GraphicsDavid LuebkeUniversity of VirginiaDisplay Technologies, Mathematical FundamentalsAdminCall rollIntroductions: Sam Guarnieri–Office hours:M – 11-12 amW 10-11 amAssignment 1 outDemoSoap-bubble bunnyMathematical FoundationsA very brief review of some mathematical tools we’ll employ–Geometry (2D, 3D)–Trigonometry–Vector and affine spaces Points, vectors, and coordinates–Dot and cross products–Linear transforms and matrices3D GeometryTo model, animate, and render 3D scenes, we must specify:–Location–Displacement from arbitrary locations–OrientationWe’ll look at two types of spaces:–Vector spaces–Affine spacesWe will often be sloppy about the distinctionVector SpacesGiven a basis for a vector space:–Each vector in the space is a unique linear combination of the basis vectors–The coordinates of a vector are the scalars from this linear combination–Best-known example: Cartesian coordinates–Note that a given vector will have different coordinates for different basesVectors And PointsWe commonly use vectors to represent:–Direction (i.e., orientation)–Points in space (i.e., location)–Displacements from point to pointBut we want points and directions to behave differently–Ex: To translate something means to move it without changing its orientation–Translation of a point = different point–Translation of a direction = same directionAffine SpacesTo be more rigorous, we need an explicit notion of position Affine spaces add a third element to vector spaces: points (P, Q, R, …)Points support these operations–Point-point subtraction: Q - P = vResult is a vector pointing from P to Q–Vector-point addition: P + v = QResult is a new pointP + 0 = P–Note that the addition of two points is not definedPQvAffine SpacesPoints, like vectors, can be expressed in coordinates–The definition uses an affine combination–Net effect is same: expressing a point in terms of a basisThus the common practice of representing points as vectors with coordinates Be careful to avoid nonsensical operations–Point + point–Scalar * pointAffine Lines: An AsideParametric representation of a line with a direction vector d and a point P1 on the line:P() = Porigin + dRestricting 0 produces a raySetting d to P - Q and restricting 0 1 produces a line segment between P and QDot ProductThe dot product or, more generally, inner product of two vectors is a scalar:v1 • v2 = x1x2 + y1y2 + z1z2 (in 3D)Useful for many purposes–Computing the length of a vector: length(v) = sqrt(v • v)–Normalizing a vector, making it unit-length–Computing the angle between two vectors:u • v = |u| |v| cos(θ)–Checking two vectors for orthogonality–Projecting one vector onto anotherθuvCross ProductThe cross product or vector product of two vectors is a vector:Cross product of two vectors is orthogonal to bothRight-hand rule dictates direction of cross productCross product is handy for finding surface orientation–Lighting–Visibility12211221122121)(y x y xz x z xz y z yvvLinear TransformationsA linear transformation: –Maps one vector to another–Preserves linear combinationsThus behavior of linear transformation is completely determined by what it does to a basisTurns out any linear transform can be represented by a matrixMatricesBy convention, matrix element Mrc is located at row r and column c:By (OpenGL) convention, vectors are columns:mnm2m12n22211n1211MMMMMMMMMM32vvvv1MatricesMatrix-vector multiplication applies a linear transformation to a vector:Recall how to do matrix multiplication-zyxvvvMMMMMMMMMvM333231232221131211Matrix TransformationsA sequence or composition of linear transformations corresponds to the product of the corresponding matrices–Note: the matrices to the right affect vector first–Note: order of matrices matters!The identity matrix I has no effect in multiplicationSome (not all) matrices have an inverse: vvMM 13D Scene RepresentationScene is usually approximated by 3D primitives–Point–Line segment–Polygon–Polyhedron–Curved surface–Solid object –etc.3D PointSpecifies a locationOrigin3D PointSpecifies a location–Represented by three coordinates–Infinitely smalltypedef struct {Coordinate x;Coordinate y;Coordinate z;} Point;typedef struct {Coordinate x;Coordinate y;Coordinate z;} Point;(x,y,z)Origin3D VectorSpecifies a direction and a magnitude3D VectorSpecifies a direction and a magnitude–Represented by three coordinates–Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz)–Has no locationtypedef struct {Coordinate dx;Coordinate dy;Coordinate dz;} Vector;typedef struct {Coordinate dx;Coordinate dy;Coordinate dz;} Vector;(dx,dy,dz)3D VectorSpecifies a direction and a magnitude–Represented by three coordinates–Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz)–Has no locationDot product of two 3D vectors–V1·V2 = dx1dx2 + dy1dy2 + dz1dz2–V1·V2 = ||V1 || || V2 || cos()typedef struct {Coordinate dx;Coordinate dy;Coordinate dz;} Vector;typedef struct {Coordinate dx;Coordinate dy;Coordinate dz;} Vector;(dx1,dy1,dz1)(dx2,dy2 ,dz2)3D Line SegmentLinear path between two pointsOrigin3D Line SegmentUse a linear combination of two points–Parametric representation:P = P1 + t (P2 - P1), (0 t 1)typedef struct {Point P1;Point P2;} Segment;typedef struct {Point P1;Point P2;} Segment;P1P2Origin3D
View Full Document