0% found this document useful (0 votes)
27 views13 pages

Curves Fractals

Uploaded by

kambleyamini15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views13 pages

Curves Fractals

Uploaded by

kambleyamini15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Curve & Fractals

 Curve generation:- Designing objects involve simple extensions


of technique for representing curves with parameters like
1Control point:- A common way to control the shape of a curve
interactively is to locate point through which the curve must pass or
points that control the curve shape.(fig 5-3 q1)

2.Multiple values:- In general, the curve cannot be represented as


a graph of single-valued function of a co-ordinate irrespective of
choice of co-ordinate system.

3.Axis independence:-The shape of an object must not change


when the control points are measured in a different co-ordinate
system. (fig 5-4 q1).

4. Global/Local control:- The change made should be applied to


the specific region above the curve & not to the whole section

1
 5.Variation property:- The mathematical representation for curve
should be applied to the selected curve & not cross arbitrarily
chosen straight line more often than a sequence of lines that
connect the knot point

 6.Versatility:- A curve representation that allows only limited


variety of shape. The curve can be drawn with two approaches
as 1.To develop a curve generation algorithm such as DDA. A
true curve is created with this approach.

 2. Approximate a curve by a number of small straight line


segments. Interpolation technique is used for this approach.

 Properties of Curves:-1.Used to represent graphics in arc form


 2.To represent the curve, control points are necessary. It
represents the depth of the object.
 3.Curve can uniform/non-uniform, as many control points are
selected that decides the smoothness/fineness of the curve.
 4.Curves are drawn by Bezier & B-spline algorithm.

2
Arc Generation With-DDA
 The differential equation for the arc co-ordinates can be written in
terms of an angle Ø as follows
X=Rcos Ø + x0 & y=Rsin Ø + y0------------equ1
Where
(x0, y0)is the center of curvature & R is the arc radius.

 Differentiating means changing x by dx & y by dy if Ø is changed


by dØ. dx=- R sin Ø dØ and dy= R cos Ø dØ

 R cos Ø=x-x0 and R sin Ø=y-y0


So that dx= -(y-y0) dØ
dy= (x-x0) dØ
 The changes dx & dy tell the amount to add to an old point on the
arc to get a new point.
x2=x1+dx=x1-(y1-y0) dØ y2=y1+dy=y1+(x2-x0) dØ

3
 This equn. forms the basis for an arc generation algorithm. To
have smooth curve, the neighboring points on the arc should be
close to each other.
 To achieve this, the value of dØ should be small enough not to
leave gaps in the arc. So can be determined as
dØ=min[0.01,1/3.2 x (|x-x0| + |y-y0|)]
 Algorithm step:-
 1.Read the center of a curvature, say(x0,y0)
 2.Read the arc angle, say Ø
 3.Read the straight point of the arc, say(x,y).
 4.Calculate dØ as dØ=min[0.01,1/3.2 x (|x-x0| + |y-y0|)]
 5.Initialise Angle=0
 6.while(Angle<0)
do{
plot(x,y)
X=x-(y-y0) dØ & Y=y+(x-xo) dØ Angle=Angle + dØ }
 7.STOP

4
Interpolation
 Interpolation deals with complex curves which have no direct
mathematical function. Such curves can be designed using
approximation methods.

 If set of sample points lie on the required curve, then draw the
required curve by filling portion of the curve with the piece of
known curves which pass through nearby sample points.

 The gap between the sample points can be filled by finding the
co-ordinates of the points along with the known approximating
curve & connecting these points with line segment.

 The main task in this process is to find the suitable mathematical


expression for known curve. There are polynomial,trignometric,
exponential &other classes of functions that can be used to
approximate the curve. Polynomail function in parametric form is
x=fx(u), y=fy(u), z=fz(u) {fig5-6 q8}

5
 We have to draw the curve by determining the intermediate
points between the known sample points. This can be achieved
using interpolation technique.

 Consider a polynomial curve that pass through n sample points


(x1,y1,z1), (x2,y2,z2)…(xn,yn,zn) the function can be
constructed as the sum of terms, one term for each sample point.

 fx(u)= Σxi Bi(u) fy(u)= Σyi Bi(u) & fz(u)= Σzi Bi(u) Σfrom i=1 to n.
The function Bi(u) are called Blending functions. For each value
of u, the blending function determines which ith sample point
affects the position of the curve.

 The function Bi(u) tells how hard the ith sample point is pulling. If
for some value of u, Bi(u)=1 & for each j!=I, Bi(u)=0, then ith
sample point has complete control of the curve.

 The curve will pass through ith sample point. Create a blending
function for which the sample points(x1,y1,z1) have complete
control when u=-1,2nd when u=0, 3rd when u=1 & so on..
6
 Blending function required is
B1(u)=1 at u=-1
B1(u) at u=0,1,2,3…n-2
so an expression is 0 at:
u(u-1)(u-2)…[u-(n-2)]
at u=-1,it is (-1)(-2)(-3)….(1-n)

 So dividing by constant, it gives 1 at u=-1 so


Bi(u)= u(u-1)(u-2)….[(u-(n-2)]
(-1)(-2)(-3)…..(1-n)

 The ith blending function can be constructed in the same way to


be 1 at u=i-2 & 0 at other integers. So Bi(u) given as
(u+1)(u)(u-1)….[u-(i-3)][u-(i-1]…[u-(i-2)]
(i-1)(i-2)(i-3)…..1(-1)….(i-n)

 The curve which is approximated using above equation is called


Lagrange interpolation.

7
 For four sample points,4blending functions are required
 B1(u)=u(u-1)(u-2) / (-1)(-2)(-3)
 B2(u)=(u+1)(u-1)(u-2)/ 1(-1)(-2)
 B3(u)=(u+1)u(u-2)/ 2(1)(-1)
 B4(u)=(u+1)u(u-1)/3(2)(1)

 Using these functions & 4sample points a curve can be


constructed which passes through four sample points
 X=x1B1(u)+x2B2(u)+x3B3(u)+x4B4(u)
 y=y1B1(u)+y2B2(u)+y3B3(u)+y4B4(u)
 z=z11B1(u)+z2B2(u)+z3B3(u)+z4B4(u)

 The curve must be close to actual curve in the region of 4points,


particularly in the middle, between 2nd & 3rd sample points. This
portion of curve is followed as u varies between 0 & 1. The result
of these calculation provides the co-ordinate which can be used
as endpoints for small line segments

8
Approximation
 To approximate a curve between 2nd & 3rd sample points by 3
straight line segments, there are number of sample points values
at u=0 & u=1. Use equation to calculate points at u=1/3 & 2/3.

 The entire curve can be approximated by representing this


process. Consider 4sample points (1,2,3,4) & approximate curve
between the middle two(2,3). Then step up 1sample point,
picking up a new sample point at 1end & discarding a point at the
other end(2,3,4,5). The curve between sample points (3,4)is
approximated.

 Then continue moving through sample points until the curve is


drawn. The initial & final portion of the curve will require special
handling. For 1st 4 points(1,2,3,4) draw region between
points(1,2) with u values between -1 & 0. Last step of the curve
should be evaluated with u values between 1 & 2.fig5-7q12

9
Interpolation Algorithm
 Step1:- Get the sample point.
 Step2:-get the intermediate value of u to determine intermediate
points.
 Step3:- Calculate the blending function values for middle section
of the curve.
 Step4:- Calculate blending function values for the 1st section of
the curve.
 Step5:- Calculate blending function values for the last section of
the curve.
 Step6:- multiply the sample points by blending function to give an
approximation curve.
 Step7:-Connect the neighboring points using straight line
segments.
 Step8:-STOP

10
B-spline curve
 The lagrange interpolation program produces various
inadequacies. In this method, the sum of the blending function is
not 1 at every value of u.

 The blending functions were designed to sum at 1 for integer


values of u & not fractional values. Each section of the curve is
connected to the next section at a sample point.

 It is not necessary that the slope of the two sections match at this
point. Thus, it doesn’t result in a completely smooth curve, if
there are corners at the sample point. The control of the curve
depends on u.

 To get the smooth control over the curve, the curve must be
pulled onto the neighborhood of sample point rather than force it
to go through the point. The result will be a curve which follows
the general contours indicated by the sample points, but may not
actually pass through the points.
11
 A set of blending functions which follows the above approach
and always sum to 1 is referred as B- spline.

 For most of the applications, the cubic B-spline functions are


adequate. The cubic B-spline blending functions interpolate over
four sample points & are cubic polynomials in u.

 For the middle of the curve, the cubic B-spline functions are:
 B1(u)=(1-u3 )/6
 B2(u)=u3 /(2-u2 )+2/3
 B3(u)= -u3 /(2+u2 ) / (2+u2 )/ (2+u)/2+1/6
 B4(u)=u3 /6 (Fig5-8 q13)

12
Features of B-spline curve
 It contains the Bernstein basis as a special case. The B-spline
basis is non-global

 It is non-global because each vertex Bi is associated with unique


basis function. Thus, each vertex affects the shape of the curve
only over a range of parameter values where its associated basis
function is non-zero.

 The B-spline basis also allows the order of the basis function &
hence the degree of the resulting curve is independent on the
number of vertices.

 It is possible to change the degree of the resulting curve without


changing the number of vertices of the defining polygon.

13

You might also like