510 likes | 536 Views
Explore the fundamentals of geometry and mathematics in computer graphics, including concepts like vector spaces, coordinate reference frames, points and lines, polygon topologies, and more.
E N D
4 1 4 4 3 3 2 1 3 1 2 2 Geometry and Mathematics for Computer Graphics
Contents • Spaces • Coordinate-reference Frames • Points and Lines • Parametric Representation • Polygon Topologies • Higher Order Geometry • Vectors • Matrices
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!
General Transformation For general non-singular linear transformations T, 사각형과 Euclidean, Affine, Projective transformation에 의한 변형 예
Coordinate Reference Frames • Coordinate Reference Frames • Cartesian coordinate system x,y,z좌표축사용, 전형적 좌표계 • Non-Cartesian coordinate system • 특수한 경우의 object표현에 사용. • Polar, Spherical, Cylindrical 좌표계등
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
4 1 4 4 3 3 2 1 3 1 2 2 Geometry vs. Topology Geometry : Where Things are (e.g., coordinates) Topology : How things are connected
Geometry : Points • 가장 기본적인 Output Primitive • 0차원으로 크기와 길이 측정 불가 • 순서쌍(x,y)나 vector형식으로 표기 • Raster Scan display 의 한 Pixel차지 • 2D or 3D
Geometry : 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,….
Line Topologies Line Strip Lines Line Loop
Polygons • Planar • Defined as a closed sequence of points • 2D or 3D
Sidebar : What is “Planar?” above If the point P is on the plane, then : below
Some Special Polygon Topologies Triangle Triangular Strip Triangular Fan Quadrilateral Quadrilateral Strip
Convex vs. Concave Convex Concave
Higher Order Geometry When we draw a line, we do not need to specify all pixel points along the line - we just give the endpoints and let the equation determine the interior points Can we do the same with other curve and surface types?
Conics Circle Ellipse Parabola, Hyperbolar, ...
It is often handy to think of the independent parameter as consistently varying form 0.0 to 1.0
Quadrics Sphere Ellipsoid, Paraboloid, Hyperboloid, [Torus,]...
Arbitrary Curves How do we control what goes on in here?
Cubic Curves We could just fill these 12 constants with random numbers, but there must be a better way
Hermite, or Coons, Cubic Curve Specify the two end points and two end slopes - solve for A~L
Bézier Cubic Curves Specify the two end points and two “control points” - solve for A~L
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 평면사이의 위치관계
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
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