Computer Graphics Massive Review Exam 1 Notes

 A linear transformation takes a 2-vector and produces another 2-vector by simple matrix multiplication. 

Scaling an image can change the length and possibly the direction. 

Shearing an image pushes an image sideways. It can also be thought of in terms of rotation along a horizontal/vertical axis. It tilts the image clockwise in the vertical axis and counterclockwise in the horizontal axis. 






Composition of Transformations:

Sometimes there is more than 1 transformation that is desired to be applied. We multiply all the transformation vectors with each other. 

Transforms are applied from the right side first. So let's say we want to rotate and scale a particular matrix. Denote this by the equation v3 = RSv1, where the scale(S) is applied first before the rotate(R). The order in which two transforms are applied is very different. These techniques work for any transformation. 


3D Linear Transformations

A 3D rotation can be decomposed into many 3D shear matrices. 



Transforms can not be used to move objects, but to scale and rotate him. We have to use a 3x3 matrix to translate. 


x' = m11 * x + m12 * y,   y' = m21 * x + m22 * y

Adding an extra dimension was homogeneous coordinates. 



 


Let's say we no longer want to translate the vector. We fix this by setting the third coordinate of the above vector to zero. 


[3 2 1] is a location where [3 2 0] is a displacement or direction. 


The following employs a translation and scale. 





A coordinate system, or coordinate frame consists of an origin or a basis which is a set of three vectors. 
We have to designate some global "world" system which subsequently is used to designate all other systems. More on this in an exam review. 





Viewports help to teach the rendering engine how to put the points at the coordinates on the screen. 
Tviewport converts the [-1 ... 1] range into pixel coordinates.

Let's say nx is the number of horizontal pixels, and ny is the number of vertical pixels. The cube has width 2, and there is a lot of decisions with regards to the different choices that one has .

(0,0) is not usually the center of the screen so, there has to be some offsets that have to be shifted, which is represented by the far right of the matrix.  The result will be some 4D vector, and the important thing is that pixel coordinates are received. 


Canonical means to be chosen by convenience. 

This is the viewport matrix and this is viewed from the op left. If you want to view from the bottom left, flip some values. 

Transformations are represented by 4x4 translation matrices, primarily motivated by a way to capture translation. There is a unified way to capture the entire transformation pipeline. 


Aspect ratio is width to height. Field of view is inversely related to the size of the object. 

This is taking a 3 dimensional space and trying to project it down to 2 dimensions. 

A characteristic of an orthographic transformation is that parallel lines remain parallel, and this is useful for technical drawings, etc. This is useful to convey the view of an object. 

The general form of an orthographic transformation is the follows:


There is a cuboid in world space. You want to map this cuboid to be centered then back down to the unit cube.  The position of this cube is entirely in relation to the locations of the cube in relation to the z axis coordinate. 


l : left plane

r: right plane

b: bottom plane

t: top plane

n: near plane

f: far plane 

  

First center the cuboid, then scale it into the unit cube. 



This is the matrix looking from the top. and moving the Center/Center of the matrix.

 
The eye position is the position that the eye sees from. The camera transformation can be used to position and orient an object that represents a camera. A camera transformation matrix is no different than computing the transformation matrix of any other object placed in a scene. 

Say R is the orientation of a camera and T is the translation of the world space. The transformation matrix is M = TR. Matrices read right to left, again this is a reminder. 


The next section which I will write about is curves.  



A curve is a set of points that a pen traces over an interval of time. There are 2 mathematical definitions of a curve.

1. The continuous image of some interval over an n-dimensional space

or

2. A continuous map from a 1-dimensional space to an n-dimensional space. 

Curves are infinitely large set of points. There are 3 ways to represent curves mathematically. 


1. Implicit curve representation - gives a procedure that can test to see that if a point is on a curve. f(x,y) = 0

2. Parametric representations, which tells where the pen is at any instant of time (x,y) = f(t).


3. Fractals/etc fall into generative and procedural curves. 

Curves can all be represented parametrically. 

The length of the curve is defined by the integral of the magnitude of the derivative as well. 



A curve can be defined as several parametric functions but the values of these functions at the end and beginning points must be the same. 

Split functions helps a lot when creating complex functions. 


Splines are piecewise polynomial functions. 




Differential geometry is the study of local properties on geometric objects. These include

Continuity

Position/Direction at a specific place at a curve

Various other derivatives. 

A "broken" curve is not a curve because these specific curves are required to be continuous. 

If f'1(0) != f'2(0) then the combined curve will have an abrupt change. C0 continuity means the positions of the curve are continuous. C1 continuity means that the positions and first derivatives are continuous and etc. 

This s=type of continuity is called parametric continuity. Geometric continuity is where the corresponding derivatives have same direction even if their magnitudes are different. 




If the C1 continuity is f1'(1) = f2'(0) then the G1 continuity is f1'(1) = k * f2'(0). 


Canonical forms of polynomials.





A line segment that connects point p0 to p1 is denoted by f(u) = (1 - u) * p0 + u * p1.

fx(u) = (1 - u) * x0 + u * x1   

fy(u) = (1 - u) * y0 + u * y1

It is much easier to write functions in the term of a equation p = Ca, where C is the constraint matrix. 

The Basis matrix is known as the inverse of the constraint matrix. 





 
The following were the basis matrices for quadratics and cubics, respectively. f = u B p where
u = [1   u   u^2    u^3 ....    u^n] and p are the constraint matrix, etc. 




There is not single "best" representation for a piecewise cubic curve. You can't have all the 4 properties:

1. Each Piece of the Curve is a Cubic
2. The Curve interpolates the Control Points
3. The Curve has Local Control
4. The Curve has C2 Continuity. 

With a piecewise curve it is possible to create a C2 curve, and doing this is possible by specifying the position of the first and second derivative at the beginning of each segment. A natural cubic spline has 
n-1 cubic segments. The first segment defines the beginning position. Unfortunately these splines are not local, and a small change at the beginning at the spline can result in a large change later. 


An example of a spline is a Hermite cubic, and they allow the positions of derivatives of each spline to be specified. Hermit cubics can provide C1 continuity and local controls for the shape. The following document demonstrates a Hermite spline. 




The last 2 things that has to be discussed here are Bezier Curves and B-Splines.

Bezier Curves are used to draw smooth curves that can be scaled indefinitely. A bezier curve is defined by a set of control points. For example, to get any curves in a segment we use a linear segment which is equivalent to a linear interpolation defined as 

L0(t) = ( 1 - t )  x P0 + t x P1.

for Quadratic, then interpolate Q0 in L0 and L1 as follows: 

L1(t) = (1 - t) P1 + t P2
Q0(t) = (1  - t) L0(t) + t(L1(t))

Cubic bezier curves follow a very similar suit.

L2(t) = (1 - t)P2 + tP3
Q1(t) = (1 - t) L1(t) + t L2(t) 
C0(t) = (1 - t) Q0(t) + t Q1(t) 

The following illustration demonstrates a cubic bezier curve: Only dependent on control points




B splines are basis functions that have a set of control points, which are specified by a basis function that has limited flexibility. 

B spline curve has a local control, the degree of the polynomial do not depend on the number of control points. It depends upon the order of the polynomial. If the order varies, then the blending function degree of this B-spline curve will be different. 

In Bezier, changing one point will change shape drastically. In the B-Spline, the points that will change will only change that particular point, only that blending function and the portion of the function will be successfully changed.  The following represents a B-Spline curve: 


Thanks for reading! 




Comments

Popular Posts