Transformantion
To Change geometric structure such as translations, scaling, rotations, and combinations of them
Translation
- position : changed
- size, angle, ... : unchanged
Scaling
size: changed:
- position, angle, ... : unchanged
Rotation
angle: changed:
- size, position, ... : unchanged
Unchanged properties : Invariant
Geometric Properties
- Position : Distance from the origin
- Distance : Relative distance ( size )
- Angle : Relative angle
- Orientation : Absolute angle
- Collineation : Preseves lines ( points on a line also form a line afeter the transformation ) L' = T(L), P' = T(P) -> Line
- Distance-preseving : Distance between any two points is preserved after the transformation, Preseve angles, area, and volume
- Conformal : Preserve angles
Geometries
- Congruent geometry : Sizes and shapes anre identical
- Conformal geometry : corresponding angles are equal
- Affine geometry : Parallel lines remain parallel and ratios are preservved
- Projective geometry : Straight lines remain straight
Isometries
- Also called as rigid-body transformation
- distance-preserving map
- rigid-body motion
- include translations, rotations, reflections
- Equations describing general 2D isometries : x′=ax+by+tx,y′=cx+dy+ty[abcd]T=[abcd]−1,|abcd|=±1
- x,y : original coordinates, x′,y′ : transformed, tx,ty : translation
Similarities
- Preseve shapes - isometry + scaling (uniform)
- Also called as conformal transformation
Shear
- Slanting an axis
- Translate along an axis and the amount of translation is proportional to its coordinates
- x′=ax+by,y′=cx+dy -> x direction : a = d = 1, b = k, c = 0 || y direction : a = d = 1, b = 0, c = k
Affines
- Collinearity ( Points on AB are transformed to points on A'B')
- Preseve parallelism : AB parallel to CD -> A'B' parallel to C'D'
- Preserve ratios : EA : EB = E'A' : E'B'
Linear Transformations
- Homogeneous linear system X′=MX
- Linaer Transformation + Translation = Affine Transformation X′=MX+T
Scaling
- Uniform scaling ( Isotropic ) : same scales for all axes
- Non-uniform scaling : Different scale for each axis
Translation
- X′=X+T, T : vector
Rotations
- x′=|P′|cos(θ+ω),y′=|P′|sin(θ+ω)
- |P|=|P′| : length invarient
- x′=xcosθ−ysinθ,y′=xsinθ+ycosθ ( 2D )
- X′=RX, |R|=1
- R−1=RT -> orthogonal matrix
Rotation around a point P
1. Translate P to the origin ( X′=X−P )
2. Rotate around the origin ( X′=RX )
3. Translate the origin to P ( X′=X+P )
=> X′=R(X−P)+P
Homogeneous Coordinates
- Except translations, all transformations can be represented as homogeneous systems, and corresponding matrix multiplications , X′=M3M2M1X,X=(M3M2M1)−1X′
- Including translations, they can be represented as matrix products and vector additions ( X′=MX+T )
-> Points on the x-y plane in 3D are equivalent to the point in 2D
-> 2D point represent to 3D point X=(hx,hy,h)ifh=1,X=(x,y,1)
- Shear transformation in xy direction
X′=SX=[10a01b001][hxhyh]=[hx+hahy+hbh]
X′=(h(x+a),h(y+b),h)→X′=(x+a,y+b) in 2D
- 3D points can be also represented in 4D
- Express translations with matrix products ( n-dim translations -> n+1-dim shear transformation )
M=[M001],T=[IT01]
- For computational efficiency, use h = 1
Orthogonal Matrix
- Definition : if AAT=I, then A is an orthogonal matrix
- By definition of inverse matrix : A−1=AT
- Orthonormal : Two vectors are orthonormal if they are orthogonal and both of unit length
- Theorem : if vectors V1,⋯,Vn form an orthonormal set, then n x n matrix constructed by setting the i-th column equal to Vi is orthogonal
- Proof : if vectors V1,⋯Vn are orthonormal Vi⋅Vj=δij. Since i-th row of AT is Vi, (i,j) element of ATA is Vi⋅Vj=δij, therefore AT=A−1
- Theeorem : if the n x n matrix M is orthogonal, then M preserves lengths and angles
- Proof : 1. Length : MX⋅MX=(MX)T(MX)=XTMTMX=XTX=X⋅X
- Angle: X⋅Y=|X||Y|cosθ,θ=cos−1(X⋅Y|X||Y|)=cos−1(MX⋅MX|MX||MY|), therefore, if MX⋅MY=X⋅Y, angle is preserved. MX⋅MY=(MX)TMY=XTMTMY=XTY=X⋅Y
- Rotation Matrix is orthogonal matrix
- 3D : (RxRyRz)−1=R−1zR−1yR−1x=RTzRTyRTx=(RxRyRz)T
Transforming Normal Vectors
- is the transformed normal vector still the normal vector? (perpendicular to the surface?)
- Tangent vector : direction of the surface at a point
- Let G be the transformation with which GN become the normal vector of the transformed surface (GN)⋅(MT)=(GN)T(MT)=NTGTMT=0, Since NTT=0,G=M if M is orthogonal
Translation of Coordinate System
- Translating coordinate system is equivalent to oppositely translating points ( X′=T−1X )
( T 만큼 translation 한다는것은, Coordinate system을 −T 만큼 translation 한것과 동일하다는 뜻 )
Rotation of Coordinate System
- Rotating coordinate system is equivalent to oppositely rotating points ( X′=R−1X )
Transformation of Coordinate System
- Rotation + Translation ( X′=(TR)−1X=R−1T−1X )
- New coordinate system is specified by
- Origin : X0
- Coordinate axes : U,V,N ( in 3D )
- N can be derived from U and V N=U×V|U×V|
Reflection and Inversion
- Reflection across a line m
- Reflectioin about a line m passing through the origin : R=[cosθ−sinθsinθcosθ], X′=R[100−1]R−1X
- Reflection about a line m passing through a point P(a,b) : T=[10a01b001], X′=TR[1000−10001]R−1T−1X
- Inversion in a point P
- inversion in a point P(a,b) : X′=T[−1000−10001]T−1X,T=[10a01b001]
- 3D Reflection
- xy : x′=x,y′=y,z′=−1 : [10001000−1]$ ...
- Reflection about a plane passing through a poiint P(a,b,c) and habing a normal vector N
- T=[abc]T
- R : Rotation to move N to z - axis ( 다른방법으로 xyz -> N UZ 으로 rotation 하는 R 을 이용해도됨 )
- X′=TR−1FxyRT−1X
3D Rotation
- Counter-clockwise rotation around axis (axis coordinate is same, other axis coordinate is roated by θ )
- Right-handed coordinate system
Rotation
- Rotation by θ around an arbitrary axis A
1. Rotate around z axis by α so that A lies on the x-z plane. Let Axy be projection of A onto x-y plane, then α = angle between Axy and x axis X′=RαX Rα : clock wise rotation with z axis
2. Rotate around y axis by β which is the angle between RαA and x axis ( X′=RβRαX )
3. Rotate around x axis by θ ( X′=RθRβRαX )
4. Rotate around y axis by −β ( X′=R−1βRθRβRαX )
5. Rotate around z axis by −α ( X′=R−1αR−1βRθRβRαX )
- Rotate P by θ around an arbitrary axis A
- Decompose P into projAP and perpAP
- projAP : parallel to A : Not changed after rotation
- perpAP : perpendicular to A
- |A|=1
- projAP′=projAP
- P=projAP+perpAP
- projAP=(A⋅P)A,perpAP=P−(A⋅P)A
- perpAP′=(A×P)sinθ+(perpAP)cosθ
- P′=projAP′+perpAP′=Pcosθ+(A×P)sinθ+A(A⋅P)(1−cosθ)
- Arbitrary rotations in 3D
- Represent the rotation as a product of successive rotations arounde ach axes
- Different orders produce different results
Rotations - Euler Angles
- Arbitrary rotations in 3D ( Pitch (x), Roll (y), Yaw (z) )
- can be achieved by a product of three elemental rotations ( rotations around a axis)
- Various combinations are possible
- Gimbal Lock
- A rotation in one axis could override a rotation in another => loss of a degree of freedom
- ex) Y axis rotated 90 degrees in X-Y-Z rotation => Z axis aligned to X axis
- Interpolation problems
- Interpolate between two rotations
- Calculated interpolations may not be smooth
Quaternions
- An alternative to Euler angles for representing rotation
- Somewhat less intuitive
- More predictable behavior and smooth interpolations
- Invented by William Hamilton as a non-commutative generalization to complex numbers
- 4-tuple : w+xi+yj+zk, where i,j,k are special imaginaries (just like i in complex number)
- i2=j2=k2=−1 , ij=−ji=k, jk=−kj=i, ki=−ik=j
Quaternions and Rotation
- Any rotation in 3-space can be encoded as a quaternion : (w,x,y,z)
- Quaternions for simple rotation around each axis
- qx=(cosα2,sinα2,0,0)
- qy=(cosβ2,0,sinβ2,0)
- qz=(cosγ2,0,0,sinγ2)
- Euler angles : multiply simple rotations : q=qxqyqz(X′=RxRyRzX)
- Quaternion (w,x,y,z) to matrix
Rq=[1−2y2−2z22xy−2wz2xz+2wy2xy+2wz1−2x2−2z22yz−2wx2xz−2wy2yz+2wx1−2x2−2y2]
- Interpolation : Interpolating points on a 4D unit sphere, Unique path between two rotations, More predictable and statble
Projection
Projection : World (3D) -> Screen (2D)
- Parallel (or orthogonal) projection
- Perspective projection
Parallel Projection
- Lengths may be scaled
- Angles may not be preserved
- Preserves parallelism of lines
Perspective Projection
- Lengths may be scaled
- Angles may not be preserved
- Parallelism of lines may not be preserved
- Perspective foreshortening
- Near objects appear larger
Parallel Projection
Projection on the plane, z=d -> x,y is same, z′=d
Perspective Projection
Plane z=d->
x′d=xz => x′=xzd
y′d=yz => y′=yzd
z′=d=zzd
M=[100001000010001d0]
Lines in 3D Space
- A line passing through a point S and having a direction V -> P=S+tV
- Distance between a point Q and a line
d2=|Q−S|2−|projV(Q−S)2|=|Q−S|2−|(Q−S)⋅V|V|2V|2
- Distance between two lines : P1,P2, P1=S1+t1V1,P2=S2+t2V2
- minimun of |P1(t1)−P2(t2)|
- |P1(t1)−P2(t2)|2=P1⋅P1+P2⋅P2−2P1⋅P2=At21+Bt22+Ct1+Dt2+Et1t2+F
- ∂f∂t1=0,∂f∂t2=0
- (V1⋅V2)2−V21V22=0 => Two lines are parallel, Distance between the line and any point on the line
Planes in 3D Space
plane : ax+by+cz+d=0, N⋅(X−P)=0, L=<N,−N⋅P>=<N,D>, (|N|=1)
- Distance between a point Q and a plane
- d=N⋅Q−N⋅P=L⋅Q
- 1. d = 0, Q is on the plane
- 2. d > 0, Q is in the positive side (normal vector direction)
- 3. d < 0, Q is in the negative side (opposite direction of normal vector)
- Intersection between three planes
- N1⋅Q−N1⋅P1=0
- N2⋅Q−N2⋅P2=0
- N3⋅Q−N3⋅P3=0
- Q=M−1[N1⋅P1N2⋅P2N3⋅P3]
- Intersection between two planes : line
- N1⋅Q−N1⋅P1=0
- N2⋅Q−N2⋅P2=0
- Q=[N1N2N1×N2]−1[N1⋅P1N2⋅P20]
- P=Q+t(N1×N2)
- Distance between a point Q and a plane
- N⋅(Q′−P)=0,Q′=Q−dN
- N⋅(Q−dN−P)=0
- d=N⋅(Q−P)=L⋅Q
Transforming Planes
- Plane : L=<N,D>=<N,−N⋅P> ( D=−N⋅P )
- Transformation F=TM=[MT01], (M : Linear Transformation, T : Translation )
- L→L′=<N′,D′>
- N' = (M^{-1}^TN, P′=FP
- D′=−N′⋅P′=−N′⋅(FP)=−((M−1)TN)⋅(MP+T)=−((M−1)TN)T(MP+T)=−NTM−1MP−NTM−1T=D−N⋅M−1T
- L′=(F−1)TL
'학교수업 > 수치해석' 카테고리의 다른 글
[Numerical Analysis] 6. Rendering (0) | 2022.05.20 |
---|---|
[Numerical Analysis] 5. Surface (0) | 2022.05.20 |
[Numerical Analysis] 4. Curve (0) | 2022.05.20 |
[Numerical Analysis] 2. Matrix (0) | 2022.05.19 |
[Numerical Analysis] 1. Vector, Line, Plane (0) | 2022.05.19 |