590 likes | 724 Views
r. A. Mathmatics for Computer Graphics. Contents. Spaces Vectors and Linear combination Affine Combination Coordinate-reference Frames Points and Lines Parametric Representation Linear Transformation Homogeneous Coordinates. Vector Spaces. A nonempty set V of vectors
E N D
r A Mathmatics for Computer Graphics
Contents • Spaces • Vectors and Linear combination • Affine Combination • Coordinate-reference Frames • Points and Lines • Parametric Representation • Linear Transformation • Homogeneous Coordinates
Vector Spaces • A nonempty set V of vectors • Vectors have magnitude and direction. • Addition + Scalar Multiplication · u+v = v+u V · (u+v)+w = u+(v+w) · u+0 = u · u+(-u) = 0 · cu V ,(c is scalar) · c(u+v) = cu+cv · (c+d)u = cu+du · c(du) = (cd)u · 1u = u Directed Line Segments … but, have no position ! Identical Vectors
Affine Spaces e2 Introducing the concepts of “points”, which represents “the location” e3 Contain the necessary elements for building geometric models e2 e1 e1 e3 Points와 그에 종속된Vector들로 표현 Basis vectors located at the origin P Truncated plane (No Origin) : Vector Space P 기준의 새 좌표계 설정 : Affine Space
Euclidean Spaces • Affine spaces have no concepts of how far apart two points are, or of what the length of a vector is • To Support a measure of distance between points,such as,..Inner Product!
P2 y2 V y1 P1 x1 x2 Points and Vectors • Point : 좌표계의 한 점을 차지 ,위치표시 • Vector : 두 position간의 차로 정의 • Magnitude와 Direction으로도 표기
z V y x Vectors (계속) • 3차원에서의 Vector • Vector Addition and Scalar Multiplication
V2 V1 |V2|cos Scalar Product • Dot Product, Inner Product라고도 함 For Cartesian reference frame, Some Properties Commutative Distributive
Scalar Product (계속) (x2,y2) (x1,y1,z1) V2 (x2,y2,z2) (x1,y1) V1 (x0,y0) (x0,y0,z0) Edge사이의 사잇각 Polygon의 면적
V1 V2 V2 V1 Vector Product • ux,uy,uz를 각 축의 단위 vector라 하면, Properties AntiCommutative Not Assotiative Distributive
Vector Product (계속) Shading, Reflection Model 평면사이의 위치관계
Vector Spaces • A nonempty set V of vectors • Addition + Scalar Multiplication · u+v = v+u V · (u+v)+w = u+(v+w) · u+0 = u · u+(-u) = 0 · cu V ,(c is scalar) · c(u+v) = cu+cv · (c+d)u = cu+du · c(du) = (cd)u · 1u = u
v v Linear Combination • Consist of scalar and vectors Ex) Single Vector의 linear combination v : real number : nonnegative
Span • Span Vector set의 모든 가능한 linear combination을 지칭 Ex) Span{v1,v2} v1 +v2 v1 v2 두Vector의 linear combination
Linearly Independence A set of vectors B={v1,…,vp} in V is said to be linearly independent if the vector equation has only the trivial solution c1=0,…,cp=0. (3,1) (6,2) Linearly dependent, w in Span{u,v} v u w Linearly dependent, Collinear (3,2) w (6,2) Linearly independent, wnot in Span{u,v} v u Linearly independent, Not collinear
Basis 어떤 linearly independent vector set B에 의해 vector space H가 span될 때, 이 vector set B를 H의 basis 라 한다. H = Span{b1, … ,bp} z u3 u1 u2 y x The standard basis for R3
for all k for all j k Orthogonal Basis Orthogonal basis - 각 원소 vector들이 서로 직교 할 때 z - u3 u1 u2 y - x Orthonormal basis ※ Orthonormal basis 각 원소 vector들이 서로 직교 하면서 동시에 단위 vector로 이루어져 있을 때
Affine Space • The Extension of the Vector Space • Geometric operation들이 의미를 갖는 공간 • Points와 그에 종속된 vector들로 표현 P Truncated plane (No Origin) : Vector Space P 기준의 새 좌표계 설정 : Affine Space
Affine Combination • Linear combination of points in an affine space make no sense (Operations on the points are limited) • Using Parametric Representation Affine combination of two points Line segment joining P1and P2, if 0 t 1
Affine Combination Generalized form One Example of Affine Combination gives a point in the triangle.
Euclidean Transformation • One-to-One Correspondence between the points of such space and the set of all real-number pair or triples • Transforming Only by rotation and translation Action of the euclidean group on five points
Affine Transformation R is Replaced by a general non-singular transformation matrix A Parallel lines are preseved. Action of the affine group on five points
General Linear Transformation For general non-singular linear transformations T, We get general linear or projective group of transformations. It preserves the collinearity of points. Action of the projective group on five points
Coordinate Reference Frames • Coordinate Reference Frames • Cartesian coordinate system x,y,z좌표축사용, 전형적 좌표계 • Non-Cartesian coordinate system • 특수한 경우의 object표현에 사용. • Polar, Spherical, Cylindrical 좌표계등
2 D Coordinate System • Two-dimensional Cartesian Reference Frames y x y x a) b)
Polar Coordinates • 가장 많이 쓰이는 non-Cartesian System • Elliptical coordinates, hyperbolic, parabolic plane coordinates등 원 이외에 symmetry를 가진 다른 2차 곡선들로도 좌표계 표현 가능. r
Why Polar Coordinates? 예) 원의 표현 y y d d x x dx dx 균등하게 분포되지 않은 점들 연속된 점들 사이에 일정간격유지 Polar Coordinates Cartesian Coordinates
3D Cartesian Frames Three Dimensional Point
3D Cartesian Frames • 오른손 좌표계 • - 대부분의 Graphics Package에서 표준 • 왼손 좌표계 • - 관찰자로부터 얼마만큼 떨어져 있는지 • 나타내기에 편리함 • - Video Monitor의 좌표계
z axis z z axis P(,,z) P(r,, ) r y axis y axis x axis x axis 3D NonCartesian System • Cylindrical coordinates • Spherical coordinates
Points • 가장 기본적인 Output Primitive • 0차원으로 크기와 길이 측정 불가 • 순서쌍(x,y)나 vector형식으로 표기 • Raster Scan display 의 한 Pixel차지 • 2D or 3D
Lines • Defined as a list of points(PolyLine) • Rasterization • Stairstep effect(jaggies)
Line Drawing Algorithm • Accomplished by calculating intermediate positions along the line path between two specified endpoint positions Bresenham’s Line Algorithm
y x Why “y=mx” is not good for Graphics Applications • Defects in Nonparametric representation • Explicit function의 경우 1. Can only represent infinite lines, not finite line segments 2. Cannot represent vertical lines(m=) 3. Can only 2D lines, not 3D • Implicit function의 경우 Redundant representation Ex) 원호의 표현 :
Parametric Line Equation P2 p p = P1 + t * ( P2 - P1 ) P1 x = X1 + t * ( X2 - X1 ) y = Y1 + t * ( Y2 -Y1 ) 0.0 t 1.0 z = Z1 + t * ( Z2 - Z1 )
Parametric Line Equation Can Also be thought of as a blending function... P2 P1 x = ( 1 - t ) * X1 + t * X2 y = ( 1 - t ) * Y1 + t * Y2 0.0 t 1.0 z = ( 1 - t ) * Z1 + t * Z2
Linear Blending You can linearly blend any two quantities with : q = Q1 + t * ( Q2 - Q1 ) Or, if you’d prefer : q = ( 1 - t ) * Q1 + t * Q2 Color, Shape, Location, Angle, Scale factors,….
Matrices • Definition • A rectangular array of quantities • Scalar multiplication and Matrix Addition
j-th column i-th row m × = (i,j) l l n m n Matrix Multiplication • Definition • Properties Not Commutative Assotiative Distributive Scalar multiplication
Translation y P x (a) y P’ x (b)
(xf,yf) y P1 P2 P3 x (xf, yf) : fixed point Scaling x’ = x · Sx , y’ = y · Sy x x’ x’ = xf + (x-xf) sx , y’ = yf + ( y- yf) sy
Rotation P’ = R P x = r cos , y = r sin x’ = r cos ( + ) = r cos cos - r sin sin y’ = r sin ( + ) = r cos sin + r sin cos x’= x cos - y sin , y’ = x sin + y cos (x’,y’) r (x,y) r 죄표중심을 회전점으로 각 만큼 회전
Homogeneous Coordinates In basic Transformations, ( Addition ) Only Translation is treated differently ( Multiplication ) ( Multiplication ) We hope to combine the multiplicative and translational terms for two-dimensional geometric transformations into a single matrix representation for enabling the composite transformations such as,
(xf,yf) y P1 P2 P3 x (xf, yf) : fixed point Extend the matrix We can solve this problem by extending 2 by2 matrix into 3 by 3 matrix Rotation Scaling Translation Ex)
y P(hx1,hy1,h) = P(X,Y, h) z =3 P(3x1,3y1,3) z =2 z =1 P(2x1,2y1,2) x P(x1,y1,1) Homogeneous Space Any two dimensional point can be represented by one of the points along the ray in 3D space 3D Representarion of homogeneous space
Point at Infinity The points with h=0 are called points at infinity, and this will not appear very often. Ex) [ X Y h ] = [ 4 3 1]
Point at Infinity(Cont’d) Ex) The intersection point of two Parallel lines The resulting homogeneous coordinates [1 -1 0] represent the ‘point of intersection’ for the two parallel lines, i.e. a point at infinity.
Point at Infinity(Cont’d) B A Two Lines are intersect each other if they are not parallel Non-Homogeneous treatment !!
Determinant of Matrix • For n 2, the Determinant of nn matrix A is, and for a 2 by 2 matrix, Ex) • if A is a triangular matrix, det A is the product of the entries on the main diagonal of A
Properties of Determinants • Row Operations Let A,B be a square matrix 1) A의 한 행의 실수배가 다른 row에 더해져 B를 만들었다면, detB = detA 2) A의 두 행이 교환되어 B를 생성했다면, detB = -detA 3) A의 한 행이 k배된 것이 B라면, detB = kdetA Ex) • Column Operations