Cc&a 2
Cc&a 2
1 0 0
0 1 0
-10 -10 1
Take step 2: convert size of window to viewport size
sx=(1-0.5)/(11-1) 0.5/10 0.05
sy=(1-0.5)/(11-1) 0.5/100.05
University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013
13
Example
so scaling transformation matrix will be
0.05 0 0
0 0.05 0
0 0 1
1 0 0
0 1 0
0.5 0.5 1
University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013
14
Introduction to curves
• Representation of curves
• Non parametric ( Generic ) representation
• Parametric representation
Non parametric curves
• The curve is represented as relationship between x,y and z.
• It may be expressed in form: f(x,y,z)=0
• X2/a2 + y2/b2 = 1
• aX2 + by2+ 2kxy+2gx+2hy+c = 1
Types of non – parametric representation
1. Explicit Non – Parametric Representation
Y=f(x)
Or y=f(x) and z= g(x)
2. Implicit Non – Parametric Representation
• X2/a2 + y2/b2 = 1
• aX2 + by2+ 2kxy+2gx+2hy+c = 1
Limitations of Non – Parametric
Representation of curves
1. Due to one to one relation, the explicit non – parametric
representation cannot be used for representing closed curves.
2. If the straight line is vertical or near vertical, its slope ‘m’ is infinity
or very large value. Such values are difficult to handle in
computation.
3. The implicit non – parametric representation of curves requires
solving of simultaneous equations, which is highly inconvenient and
lengthy.
Parametric representation
• The curve is represented not as the relationship between x,y and z
but as a function of independent parameter such as u or θ.
• X = x(u)
• Y = y (u)
• Z = z(u)
• Or
• X = r cos θ
• Y = r sin θ
Parametric curves
• Parametric representation of curves overcomes all difficulties of
nonparametric representation.
• Each point one is expressed not as the relationships between x,y,z but
as a function of independent parameter ‘u’. The parameter ‘u’ acts as
a local coordinate for the points on the curve.
• P (u) = [x , y] = [x(u) y (u)]
umin <= u <= u max
• Advantages
• Each variable to be treated separately
• Easily transformation
• It can be easily used for representing closed and multivalued curves.
• It is suitable for partial curves.
• It replaces slopes by tangent vectors.
Types of curves
• Analytical curves:
• The curves which are defined by the analytic equations are known as analytic
curves
• The examples of analytic curves are: line, circle, ellipse, parabola, and
hyperbola
• Synthetic curves:
• The curves which are defined by the set of data points are known as synthetic
curves
• The examples of synthetic curves are: cubic spline, B-spline. Nu- spline, beta –
spline, and Bezier curves.
• Curves are used for representing profile of: car bodies, ships, areoplane,
bottles. Etc…
Parametric representation of Lines
• P (t) = P1 +( P2 – P1) * t 0<=t<=1
• In scalar form, the equation can be written as
• x= x1 +( x2 – x1) * t 0<=t<=1
• y=y1 +(y2 – y1) * t 0<=t<=1
• z=z1 +( z2 – z1) * t 0<=t<=1
• Tangent vector of line:
• P’ = P2 – P1
• x’= x2 – x1 0<=t<=1
• y’=y2 – y1 0<=t<=1
• z’=z2 – z1 0<=t<=1
The unit vector in the direction of line is given by
A line joins two points (3,4,6) and
(5,7,1).write
1. The parametric equation of the line.
2. The tangent vector of the line.
3. The unit vector in the direction of the line.
Solution:
• xn=xc + A cos u
• yn=yc + B sin u
• zn=zc
• Where 0 <= u <= 2 ᴨ
• Recursive method
• Xn+1=xc + ( x n – x c) cos Δu – A/B*( y n – y c) sin Δu
• yn+1=yc + ( y n – y c) cos Δu + A/B * ( x n – x c) sin Δu
• Zn+1=zc
Problem:
• An ellipse has major axis 10 units and minor axis 6 units. If the centre
of ellipse is (8,5,3). Write its parametric equation.
• Solution: A= 10/2 = 5 B = 6/2 = 3
• Pc (8,5,3)
• xn=xc + A cos u = 8+5cos u
• yn=yc + B sin u = 5 + 3sin u
• zn=zc = 3
Xn+1=xc + ( x n – x c) cos Δu – A/B*( y n – y c) sin Δu
yn+1=yc + ( y n – y c) cos Δu + A/B * ( x n – x c) sin Δu
Zn+1=zc
U 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
1 1.96 2.80 3.68 4.50 5.25 5.89 6.418 6.792 6.99 7
3 3.395 3.6 3.64 3.56 3.37 3.12 2.825 2.52 2.235 2
Find the equation of two dimensional Hermite cubic spline curve having end points
P0(0,0) and P1(6,3). The two control points P2(10,8) and P3(6,0) are oriented such
that lines P0,P2 and P1,P3 tangent to the curves. Plot the curve also.