Download Geometry and Mathematics for Computer Graphics Geometry

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Geometry and Mathematics
for Computer Graphics
4
1
4
3
2
1
3
2
4
1
3
2
Contents
 Spaces
 Coordinate-reference Frames
 Points and Lines
 Parametric Representation
 Polygon Topologies
 Higher Order Geometry
 Vectors
 Matrices
Geometry and Mathematics for Computer Graphics
Vector Spaces
 A nonempty set V of vectors
 Vectors have magnitude and direction.
 Addition + Scalar Multiplication
·
·
·
·
·
u+v = v+u  V
u+0 = u
cu V ,(c is scalar)
c(u+v) = cu+cv
c(du) = (cd)u
· (u+v)+w = u+(v+w)
· u+(-u) = 0
Directed Line Segments
· (c+d)u = cu+du
· 1u = u
… but, have no position !
Identical Vectors
Geometry and Mathematics for Computer Graphics
Affine Spaces
e2
 Introducing the concepts of “points”,
which represents “the location”
e3
e1
e2
e1
e3
 Contain the necessary elements for
building geometric models
 Points와 그에 종속된 Vector들로 표현
Basis vectors located at the origin
P
Truncated plane (No Origin)
: Vector Space
Geometry and Mathematics for Computer Graphics
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!
P  Q  ( P  Q)  ( P  Q )
Geometry and Mathematics for Computer Graphics
General Transformation
For general non-singular linear transformations T,
 x'   t11 t12 t13  x 
  
 
 y '    t 21 t 22 t 23  y 
 w'   t t t  w 
   31 32 33  
사각형과 Euclidean, Affine, Projective transformation에 의한 변형 예
Geometry and Mathematics for Computer Graphics
Coordinate Reference Frames
 Coordinate Reference Frames
 Cartesian coordinate system
x,y,z좌표축사용, 전형적 좌표계
 Non-Cartesian coordinate system
– 특수한 경우의 object표현에 사용.
– Polar, Spherical, Cylindrical 좌표계등
Geometry and Mathematics for Computer Graphics
2D Coordinate System
Y
X
Geometry and Mathematics for Computer Graphics
Polar Coordinates
 가장 많이 쓰이는 non-Cartesian System
r

x  r cos ,
y  r sin 
r x y ,
2
2
 y
  tan  
 x
1
s  r
 Elliptical coordinates, hyperbolic, parabolic plane
coordinates등 원 이외에 symmetry를 가진 다른 2차
곡선들로도 좌표계 표현 가능.
Geometry and Mathematics for Computer Graphics
Why Polar Coordinates?
예) 원의 표현
y
x2  y2  r 2
x  r cos ,
y
y  r sin 
d
d
x
x
dx dx
균등하게 분포되지 않은 점들
Cartesian Coordinates
Geometry and Mathematics for Computer Graphics
연속된 점들 사이에 일정간격유지
Polar Coordinates
3D Cartesian Frames
Three Dimensional Point
Geometry and Mathematics for Computer Graphics
3D Cartesian Frames
 오른손 좌표계
- 대부분의 Graphics Package에서 표준
 왼손 좌표계
- 관찰자로부터 얼마만큼 떨어져 있는지
나타내기에 편리함
- Video Monitor의 좌표계
Geometry and Mathematics for Computer Graphics
3D NonCartesian System
 Cylindrical coordinates
 Spherical coordinates
z axis
z z axis
P(,,z)
P(r,, )

r
 
x axis
y axis
x   cos 
y   sin 
zz
Geometry and Mathematics for Computer Graphics

x axis
y axis
x  r cos  sin 
y  r sin  sin 
z  r cos 
Geometry vs. Topology
Geometry :
Where Things are (e.g., coordinates)
Topology :
How things are connected
4
1
4
3
2
1
3
2
Geometry and Mathematics for Computer Graphics
4
1
3
2
Geometry : Points
 가장 기본적인 Output Primitive
 0차원으로 크기와 길이 측정 불가
 순서쌍(x,y)나 vector형식으로 표기
 Raster Scan display 의 한 Pixel차지
 2D or 3D
Geometry and Mathematics for Computer Graphics
Geometry : Lines
 Defined as a list of points(PolyLine)
 Rasterization
 Stairstep effect(jaggies)
Geometry and Mathematics for Computer Graphics
Line Drawing Algorithm
 Accomplished by calculating intermediate positions
along the line path between two specified endpoint
positions
y  2x 1
Geometry and Mathematics for Computer Graphics
Bresenham’s Line Algorithm
Why “y=mx” is not good
for Graphics Applications
 Defects in Nonparametric representation
 Explicit function의 경우
y  mx  b
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의 경우
y
f ( x, y )  0
Redundant representation
Ex) 원호의 표현 :
x2  y 2  1
Geometry and Mathematics for Computer Graphics
x
Parametric Line Equation
P2
p
p = P1 + t * ( P2 - P1 )
P1
x = X1 + t * ( X2 - X1 )
y = Y1 + t * ( Y2 -Y1 )
z = Z1 + t * ( Z2 - Z1 )
Geometry and Mathematics for Computer Graphics
0.0  t  1.0
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
z = ( 1 - t ) * Z1 + t * Z2
Geometry and Mathematics for Computer Graphics
0.0  t  1.0
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,….
Geometry and Mathematics for Computer Graphics
Line Topologies
Line Strip
Lines
Line Loop
Geometry and Mathematics for Computer Graphics
Line patterns : Stipples
Geometry and Mathematics for Computer Graphics
Polygons
• Planar
• Defined as a closed sequence of points
• 2D or 3D
Geometry and Mathematics for Computer Graphics
Sidebar : What is “Planar?”
(A ,B ,C )
P0
P  (x ,y ,z )
If the point P is
above
on
the plane, then :
below

A x  B y  C z  (A x 0  B y 0  C z0 )  0

Geometry and Mathematics for Computer Graphics
Some Special Polygon Topologies
Triangle
Triangular Strip
Triangular Fan
Quadrilateral
Quadrilateral Strip
Geometry and Mathematics for Computer Graphics
Polygon Patterns : Stipples
Geometry and Mathematics for Computer Graphics
Polygon Patterns :
Color Interpolation
Geometry and Mathematics for Computer Graphics
Polygon Patterns :
Texture Mapping
Geometry and Mathematics for Computer Graphics
Convex vs. Concave
Convex
Geometry and Mathematics for Computer Graphics
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?
Geometry and Mathematics for Computer Graphics
Conics
Circle
Ellipse
R
B
x  R co s 
y  R sin 
A
x  A co s 
y  B sin 
Parabola, Hyperbolar, ...
Geometry and Mathematics for Computer Graphics
0 .0  t  1.0
It is often handy to think of the independent
parameter as consistently varying form 0.0 to 1.0
R
x  R co s(360 t )
y  R sin (360 t )
Geometry and Mathematics for Computer Graphics
B
A
x  A co s(360 t )
y  B sin (360 t )
Quadrics
Sphere
Ellipsoid, Paraboloid, Hyperboloid, [Torus,]...
Geometry and Mathematics for Computer Graphics
Arbitrary Curves
How do we control what goes on in here?
Geometry and Mathematics for Computer Graphics
Cubic Curves
x  A t3  B t2  C t  D
y  E t3  F t2  G t  H
z  It3  Jt2  K t  L
0 .0  t  1.0
We could just fill these 12 constants with
random numbers, but there must be a
better way
Geometry and Mathematics for Computer Graphics
Hermite, or Coons, Cubic Curve
Specify the two end points
and two end slopes - solve
for A~L
Geometry and Mathematics for Computer Graphics
Bézier Cubic Curves
Specify the two end points
and two “control points” solve for A~L
Geometry and Mathematics for Computer Graphics
BiCubic Surfaces
As t B s t C s t D s 
3 3
X (s ,t ) 
3 2
3
3
E s 2t3  F s 2t2  G s 2t  H s 2 
Ist  Jst  K st  Ls 
3
2
M t  N t O t  P
3
2
0 .0  s ,t  1.0
Geometry and Mathematics for Computer Graphics
Bézier BiCubic Surfaces
Geometry and Mathematics for Computer Graphics
Bézier BiCubic Surfaces
Geometry and Mathematics for Computer Graphics
Points and Vectors
 Point : 좌표계의 한 점을 차지 ,위치표시
 Vector : 두 position간의 차로 정의
V  P2  P1  ( x2  x1 , y2  y1 )  (Vx ,Vy )
 Magnitude와 Direction으로도 표기
P2
y2
y1
V
V  Vx2  Vy2
 Vy
  tan 
 Vx
1
P1
x1
x2
Geometry and Mathematics for Computer Graphics




Vectors (계속)
 3차원에서의 Vector
z
V  Vx2  Vy2  Vz2
Vy
V
V
cos   x , cos  
, cos   z
|V |
|V |
|V |
cos 2   cos 2   cos 2   1



x
 Vector Addition and Scalar Multiplication
V1  V2  (V1x  V2 x , V1 y  V2 y ,V1z  V2 z )
V  (Vx ,V y , Vz )
Geometry and Mathematics for Computer Graphics
V
y
Scalar Product
 Dot Product, Inner Product라고도 함
V2

V1
V1 V2 | V1 || V2 | cos , 0    
|V2|cos
For Cartesian reference frame,
V1 V2  V1xV2 x  V1 yV2 y  V1zV2 z
Some Properties
Commutative
V1 V2  V2 V1
Distributive
V1  (V2  V3 )  V1 V2  V1 V3
Geometry and Mathematics for Computer Graphics
Scalar Product (계속)
(x2,y2)
(x1,y1,z1)
V2
(x2,y2,z2)

(x0,y0)
(x1,y1)
V1
Edge사이의 사잇각
Geometry and Mathematics for Computer Graphics
(x0,y0,z0)
Polygon의 면적
Vector Product
V1 V2  u | V1 || V2 | sin  , 0    
V1  V2
V1  V2  (V1 yV2 z  V1zV2 y ,V1zV2 x  V1xV2 z ,V1xV2 y  V1 yV2 x )
V2

V1
※ ux,uy,uz를 각 축의 단위 vector라 하면,
ux
uy
uz
V1  V2  V1x
V1 y
V1z
V2 x V2 y V2 z
Properties
AntiCommutative
V1 V2  (V2 V1 )
Not Assotiative
V1  (V2 V3 )  (V1 V2 ) V3
Distributive
V1  (V2  V3 )  (V1 V2 )  (V1 V3 )
Geometry and Mathematics for Computer Graphics
Vector Product (계속)
Shading, Reflection Model
Geometry and Mathematics for Computer Graphics
평면사이의 위치관계
Matrices
 Definition
 A rectangular array of quantities
 a11
a
A   21
 :

am1
a12
a22
:
am 2
... a1n 
... a2 n 
: 

... amn 
 Scalar multiplication and Matrix Addition
 a11 a12 
 b11 b12 
 , B  

A  
a
a
b
b
 21 22 
 21 22 
Geometry and Mathematics for Computer Graphics
a12  b12 
a b

A  B   11 11
a

b
a

b
 21 21 22 22 
ka12 
 ka

kA   11
 ka21 ka22 
Matrix Multiplication
 Definition
j-th column
C  AB
n
cij   aik bkj
k 1
i-th row
×m
l
=
(i,j)
l
n
m
n
 Properties
AB  BA
Not Commutative
Assotiative
( AB)C  A( BC )
Distributive
A( B  C )  AB  BC
Scalar multiplication
(kA) B  A(kB)  k ( AB)
Geometry and Mathematics for Computer Graphics
Determinant of Matrix
 For n 2, the Determinant of nn matrix A is,
n
det A   (1) j  k a jk det Ajk
j 1
and for a 2 by 2 matrix,
a11
a12
a21 a22
Ex)
0
1 5
A  2 4  1
0  2 0 
 a11a22  a12a21
4  1
2  1
2 4 
det A  1 det 

5

det

0

det

0 0 
 0  2
2 0 




 1 (0  2)  5  (0  0)  0  (4  0)  2
※ if A is a triangular matrix, det A is the product of the entries on the main
diagonal of A
Geometry and Mathematics for Computer Graphics
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 = kdetA
Ex)
 1 4 2 
A   2 8  9
  1 7
0 
 1 4 2 
0
0  5

 1 7
0 
1  4 2 
0 0  5


0 3
2 
1  4 2 
 det A   det 0 3
2   (1 3  (5))  15
0 0  5
 Column Operations
det AT  det A
det( AB)  (det A)(det B)
Geometry and Mathematics for Computer Graphics
1  4 2 
 0 3
2 
0 0  5
Related documents