Graphics Mathematics for Computer Graphics Laboratory Korea University
Graphics Mathematics for Computer Graphics Laboratory Korea University http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Contents KUCG n Coordinate Systems n Points and Vectors n Matrices n Parametric vs. Nonparametric Representations http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Coordinate Systems n KUCG Rectangular (Cartesian) n x, y, z axes n Typical coordinate system n Right/left-hand system n Polar n Cylindrical n Spherical http: //kucg. korea. ac. kr Graphics Lab @ Korea University
2 D Rectangular Coordinate System y KUCG x y x Coordinate origin at the lower-left screen corner Coordinate origin at the upper-left screen corner <Window Coordinate System> <Screen Coordinate System> http: //kucg. korea. ac. kr Graphics Lab @ Korea University
3 D Rectangular Coordinate System n Right-hand system n n KUCG Standard in most graphics packages Left-hand system Easy to know the distance from the viewer n Video monitor coordinate system n http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Polar Coordinate System KUCG y p(r, ) r http: //kucg. korea. ac. kr s x Graphics Lab @ Korea University
Why Polar Coordinates in Circles? n KUCG In rectangular system n Irregular distribution of continuous points y y dx dx x d d x Irregularly Distributed Adjacent Points Constant Distance among the Adjacent Points Rectangular Coordinate System Polar Coordinate System http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Cylindrical / Spherical System KUCG z z p(r, , z) z r y r p(r, , ) y x x Cylindrical Coordinate System http: //kucg. korea. ac. kr Spherical Coordinate System Graphics Lab @ Korea University
Points and Vectors KUCG n Point: location, position n Vector: direction from one point to another n Represented y P 2 y 1 V P 1 x 1 http: //kucg. korea. ac. kr by using magnitude and unit direction x 2 x Graphics Lab @ Korea University
Vectors n KUCG z 3 D Vector V y x n Vector addition and scalar multiplication http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Scalar Product n KUCG Definition V 2 V 1 Dot Product / Inner Product |V 2|cos n Properties n Commutative n Distributive http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Vector Product n KUCG Definition V 1 V 2 Cross Product / Outer Product u V 1 n Careful for its direction!!! Properties Anti-commutative n Not associative n Distributive n http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Plane Normal Calculation n KUCG Frequently used in Back face detection n Shading function n n Vector product between n Two edges of the target polygon N = V 1 × V 2 P 4 V 2 P 3 P 0 V 1 http: //kucg. korea. ac. kr P 1 P 2 Graphics Lab @ Korea University
Back Face Detection n Not drawing the back faces to be culled n n KUCG Can make the drawing speed faster Scalar product between o n Eye direction Deye and face normal vector Ni If Deye Ni > 0 o http: //kucg. korea. ac. kr Fi is back face Graphics Lab @ Korea University
Back Face Example KUCG N 4 N 3 (0. 3, 0. 7) (-0. 2, 0. 8) N 2 (-0. 8, 0. 2) Eye F 3 N 5 F 2 (0. 8, 0. 2) F 5 Eye Direction Deye(1, 0) N 1 F 4 F 1 (-0. 9, -0. 1) http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Back Face Calculation n F 1 n n F 2 n n F 3 n n F 4 n n F 5 n KUCG Deye N 1 = (1, 0) (-0. 9, -0. 1) = -0. 9 F 1 is a front face Deye N 2 = (1, 0) (-0. 8, 0. 2) = -0. 8 F 2 is a front face Deye N 3 = (1, 0) (-0. 2, 0. 8) = -0. 2 F 3 is a front face Deye N 4 = (1, 0) (0. 3, 0. 7) = 0. 3 F 4 is a back face Deye N 5 = (1, 0) (0. 8, 0. 2) = 0. 8 F 5 is a back face http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Back Face Culled Result KUCG N 4 N 3 (0. 3, 0. 7) (-0. 2, 0. 8) N 2 (-0. 8, 0. 2) Eye F 3 N 5 F 2 (0. 8, 0. 2) F 5 Eye Direction Deye(1, 0) N 1 F 4 F 1 (-0. 9, -0. 1) http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Shading Function n KUCG The amount of illumination depends on cos n If the incoming light Iin is perpendicular to the surface o Isurf o is maximum, so the surface is fully illuminated = 0, cos = 1 N Isurf: intensity of the surface Iin: intensity of the incident light k: surface reflection coefficient L: direction from the surface to a light source L <Simple Shading Function> http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Matrices n Definition n n KUCG A rectangular array of quantities Scalar multiplication and matrix addition http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Matrix Multiplication n KUCG Definition j-th column i-th row ×m l m n Properties n Not commutative n Associative n Distributive n Scalar multiplication http: //kucg. korea. ac. kr = (i, j) l n n Graphics Lab @ Korea University
Matrix Transpose n Definition n n KUCG Interchanging rows and columns Transpose of matrix product http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Determinant of Matrix n KUCG Definition n For a square matrix o Combining the matrix elements to product a single number n 2 2 matrix n Determinant of n n matrix A (n 2) http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Inverse Matrix n KUCG Definition n Non-singular matrix o If and only if the determinant of the matrix is non-zero n 2 2 matrix n Properties http: //kucg. korea. ac. kr Graphics Lab @ Korea University
Parametric vs. Nonparametric Representations n KUCG Circle example in computer graphics o radius 2, centered at the origin Parametric expression: x = 2 cos , y = 2 sin n Nonparametric expression n o Implicit: y , explicit: Which one is balanced? -2 2 x Parametric Expression Interval of : /4 http: //kucg. korea. ac. kr y -2 -1 0 1 2 x Nonparametric Expression Interval of x: 1 Graphics Lab @ Korea University
Parametric Representation n Easy to draw the shape of an object smoothly n Just increase one parameter o n ex) The other parameters are automatically calculated by Especially for symmetric objects o n KUCG Circle, sphere, ellipsoid, etc. Preferred in computer graphics n Nonparametric representation is used mainly in numerical analysis http: //kucg. korea. ac. kr Graphics Lab @ Korea University
- Slides: 25