Tip:
Highlight text to annotate it
X
Today we will see methods for displaying curves and surfaces and then we will go on to see
how solids are modeled. The first we will be seeing methods which are commonly used
for displaying curves and surfaces.
Essentially in order to achieve realism that means if we have three dimensional object
and we want to see realistically and for the sake of visualization, we have different kind
of tools that are available. You have seen some of those tools. The first one that which
saw was projections. We have seen orthographic projection, we have seen prospective projections.
Then we can have different type of orthographic projecting and prospective projection and
so on. Then we have seen how shading can, if we have let say polyhedral object how we
can shade it in order to display it in the realistic manner. Then we have talked of hidden
surface removal or hidden line removal.
Then the other methods that are there are let's say we have wire frame displays. This
means that if we have any surface, let say if I am taking a general surface like this,
we can display the surface as a family of curves in both the directions. So this way
this family of curves will give an effect that these are three dimensional surfaces
and the surface would look realistic in that manner. This is a wire frame or a wire mesh
display.
Similarly, if you want to represent a simple cylindrical object instead of just representing
it like this, we can in represented by a family, by a wire mesh and again. So, wire frame display
or a wire mesh display that can also give us realistic effect, especially if it is coupled
with midline removal. So this is another way of displaying the surfaces. And one more way
is what is referred to as intensity cues. That means depending on the depth of object
or the distance of the object from the eye different intensity levels are given, so that
gives us gain an effect that if an object is further off, it will seem to have a lower
intensity.
When I am saying intensity cues, we are not using any extensive shading model but we simply
using some heuristic that something away from the eye will appear less bright or something
like that. So intensity cues can also be used for displaying curves and surfaces
but in all these methods, whether it is wire frame display or whether it is a shaded display,
we need to display each individual curve. For example let's say if we are talking of
by cubic surface patch, this surface patch would consist of a family of curves in either
direction. If you want to display each curve, we need some specific methods for displaying
these curves.
We have seen methods for displaying straight lines circles and so on but if we have a general
three dimensional curve, in order display that we need to have a specific some special
techniques. So we will just see some of these techniques for displaying curves. The same
techniques can also be extended for displaying surfaces.
So if we are talking of curves, if we have any general curve in this manner let's say
this is the starting point, this is the end point. Now this curve, one way of the displaying
is curve is that we can display it as a sequence of straight lines. That means we will divide
this curve into a set of points like this and then display it as a set of straight lines
in a sequence. So we
want to display a sequence of straight lines, let's say along the length of the curve we
can take successive values of this parameter u. Again we are taking u equal to going from
0 to 1, let's say we take it to 0.05, 0.1 so on up to 0.95 and 1.0.
Let's say we take a sequence of such values and then we draw straight lines between each
of the successive point that we get. In fact most of the time, we like to divide this curve
into a set of straight lines, may be not in this manner but in some manner we like to
divide this curve into a set of straight lines because our methods for displaying straight
lines are simple and well known. In fact in some displays these straight lines can also
be displayed using hardware, using hardware techniques. So display a straight lines can
be done quite fast but if we are taking any general three dimensional curves having specific
routine or specific algorithms for displaying curves can be quite expensive. So typically
we will take a curve, divide it into a set of straight lines and then display those straight
lines in a sequence.
So in this case we had taken a sequence of straight lines and let's say successive values
of the parameter and we joint them by straight lines. But let's say if we are taking values
like this 0.05, 0.1, instead of getting a smooth curve or might get a curve which would
look something like this, it might not look like a smooth curve. If a curve is not looking
smooth in order to increase the smoothness, the only thing that we do on this technique
is just take a larger number of values.
So in order to get smooth curves you increase number of points, increase the number of breaks
let's just call them right now or number of parameters, number of parameter values, the
values at which I am making my curve. And I can increase that number and get a better
approximation of the curve for display purposes. I am just coming to that, I am just coming
to that.
But if I just increase a number of the number of points I am taking on this curve by just
increase it arbitrarily, what can happen is that let's say if I have a curve which looks
like this, on a curve like this let's say if I took values at a range like this earlier.
My curve would look like something like this. This portion of the curve would look very
straight and then of course again I will have some edges like this but in this portion,
my curve would look quite wrong. So now if in order to display the curve in a better
manner, I take larger points over here. What I am sincerely doing is for the whole of the
curve I am taking many more points now. If I take many more points on the whole of the
curve that is not necessary while this portion of the curve is quite flat, while this position
is having a very sharp bend. So for a flat portion, I need not take such a large density
of points.
So for flatter portion
we can have a smaller number of points for larger intervals and for portion having sharp
bend or sharp curvatures, we need a larger number of points over there. For say a situation
like this, maybe I like to take a very large number of points here and then take points
like this and then may be again take points like this. So the number of parts into which
I divide this curve that should depend on the curvature, it should not be decided randomly.
Otherwise I will either be doing waste full expenditure or waste full computation or I
end up getting a very coarse curve which won't give me a good display. And when I extend
this to a three dimensional surface, this can become even more critical because on a
surface like this, I like to divide this surface into an array of points in both the directions
and so on. If I have an array of points like this and I increase the density of this array
irrespective of the curvature of the surface, in that case again I might be doing a lot
of waste full computation. We will just see how this can be handled for a curve.
Now basic technique that we will use here is that we'll subdivide the curve, we say
on the basis of change in total slope. What we mean by that is let's say if we have a
curve like this. On this curve we are starting from this point, we have displayed this point.
Then what will say we will keep going along the length of the curve. In the next point
that we will display that will depend on how much slope has changed from this point to
that point. That means at this point where the tangent is in this direction, let's say
when I come to this point one tangent has changed to this. The change in tangent from
this point to this point that can be computed. if I have an absolutely flat curve that means
the curve like this then between this point and this point, the change in a tangent will
be almost 0 while there is some curvature then there will be some change in the direction
of the tangent.
So from this point to this point, if the tangent vector changes by let's say more than a fixed
amount then we will display a straight line between these two points. As we go along the
length of the curve, as soon as the tangent vector changes by a certain amount will display
a straight line. In this case right from here up to here, there might be no change in the
length of the tangent vector. So I will take the first point and the last point and just
draw the straight line. Similarly over here, let's say if I have drawn this as one line,
let's say I have drawn this is one point, let's say may be as three successive lines
so for.
The next point at this point we find there is significant change in the tangent vector
then I will draw straight between these two. What that mean is we will get a straight line
effect over here as long as the change in tangent between these two points is not more
than a certain amount. So this way the error that will have because
of the loss of curvature and display will be limited to a certain change in tangent
vector. And as the result of that, the type of curve that we had seen earlier I say a
curve of this type, this is the curve we have something like this.
As we start from this point, at each of these successive points initially my tangent vector
is changing very fast. So we will end of drawing a set of straight lines between each of these
points or after reaching here, from here to here may be there is not much change in the
tangent vector and form here to here again there is no change in the tangent vector.
So this complete portion will be drawn as, which will be drawn with less number of intervals.
so this way instead of arbitrarily or uniformly dividing the curve into intervals, we can
divide it into intervals on the basis of the change in the tangent vector or the change
in slope. Any questions on this? The delta and parameter proportional to the second derivative.
For the total change in slope from this point, that will depend on the second derivative
in some manner.
The other method that we can use for this, that method is also very commonly used that
is if you have curve like this, instead of looking at the slope at each point, sometimes
especially for a complex curves looking at the second derivatives or computing expression
for the second derivative might not be very easy. So what we do is we take this complete
curve and divide it into two portions. So at the center point we divide this curve into
two parts and then look at each of these parts separately. If we find at both the parts are
straight enough then we will join them a straight lines, straight enough or let say flat enough.
So if we look at this curve and this curve we find that this curve just quiet flat, we
will just joint it by straight lines. We will join this point and this point by a straight
line like this and if we find that it is not flat enough then we further divide it at the
midpoint. And then we compare this curve, we will see whether this curve is flat enough
or we will see this curve is flat enough and so on. Again if it is not flat enough, we
will subdivide it further and we continue this, we will subdivide at mid point till
each curve is either flat enough or small enough. What do you mean by small enough?
After sometime these points might become very close and actual distance between them might
become let's say it is just one pixel or couple of pixels. So after that there is no point
in subdividing it further. So keep subdividing this curve till each part of the curve becomes
flat enough or small enough and this thing can be done recursively. Again we take one
curve subdivide at the center, take the first curve again subdivide it at the center and
so on. So this is another method that can be used. Slope at same point I dint get tat.
In this case or in the previous algorithm? To find whether it is flat enough, I will
be coming to that. See what happen when we want to decide whether it is flat enough,
we can use properties of the curve itself.
For example if it is a Bezier curve, this curve has to be contained within the convex
hull. So let's say if my control points are like this then this is the convex hull. So,
if this is the base and we find the height of the convex hull, especially for the cubic
Bezier curves can be done very easily and I will say if the height of the convex hull
is less than a certain amount, my curve is flat enough or the height to base ratio is
less than a certain amount. Let me complete this thing. Let me complete the thing. Let
me complete the thing and ask the question after that, I will be answering all those
question. I will be coming to that. So what you are basically saying how do we subdivide
the curves. So let see methods of subdividing pc curves as well as Bezier curves, that will
answer your question.
So let's say if we have a pc curve, that first see pc curve then we will see Bezier curves
and then to will come to back this point. For example let say I have a curve of this
type, just take a general case when I want to subdivide it between any two points starting
from let's say u equal to ui to u equal uj. So what I want to do is between these two
points, I want to write down the equation for another pc curve. If I consider this as
a pc curve, the B matrix for my pc curve is given by p0 p1 p u 0 and p u 1 that means
staring point, end point, tangent vector at the staring and tangent vector at the end
point. So for this curve I would like to give the starting point, end point, starting tangent
vector and the ending tangent vector. So what is the starting point here? Let's say I call
this curve, this part of the curve I call it as a q curve. So q0 that is the starting
point of this curve what will that be? My this curve is let's say p curve and p of u
is known. I know the equation for this curve. So what will be the starting points for this
q curve? It will be given by p of u at u equal to ui. So this will be equal to p of ui.
Similarly, if I take q1 that will be p of uj. If I look at the tangent vector in this
direction, now when I am defining the q curve let's say I am defining a parameter v, v should
be 0 here and v should be 1 here. For this q curve my parameters v will be varying from
0 to 1. So at this point my derivative with respect to v that is what I am interested
in. So if I take up q v at 0, what will that be? The tangent vector at this point for the
p curve that is given by p u at ui but when I compute pu at ui, I am computing my differential
with respect to u but now I have to compute the differential with respect to v. So we
will get a term of dv by du that you can verify that this will be multiplied by uj minus ui,
nothing but straight forward, we can verify this derivative. So q v at 0 will be given
by this term. Similarly, if I consider q v at 1 that will be given by p u at uj that
is at this point the derivative in the p curve again multiplied by uj minus ui.
So for this q curve my B matrix will be obtained from these four terms and B matrix for the
q curve will consist of these 4 vectors p of ui, p of uj, p u of ui multiplied by uj
minus ui, p u of uj multiplied by uj minus ui. This is my starting point, this is actually
my q0, this is q of 1, this term is q v at 0 and this term is q v at 1. So if I have
any general curve like this and I want to subdivide it at ui and uj, I can get this
as another pc curve. And if I have the equation of this as another pc curve, I can again further
subdivide it using the same formulation.
As far as pc curves are concerned your question is answered. If I decide that I start with
the curve initially like this, I want to divide it into two pc curves, I subdivide it at the
midpoint. This is one pc curve, this is second pc curve,
if I have separate equations for both the curves
and they are both pc curves now. If I want to subdivide them further again I will consider
a 0.5 point for this curve and a 0.5 point for this curve and continue, that is why we
need methods for subdividing curves.
And the only thing we have to ensure is that when we subdivide a curve at any two points,
the curve that we are getting that should also be a curve of the same type. We started
with the pc curve, so this curve should also be a pc curve, the same formulation have to
be used.
If we have Bezier curves what we do in that case? Just take the case of cubic Bezier curves.
Cubic, I am taking cubic curves for sake of simplicity. The same thing can be similar
thing can extended to higher degree curves also. So if we have four points like this
p0 p1 p2 and p3, my curve let's say is defined like this, this is u equal to 0, this is u
equal to 1. If I consider the midpoint here, this is u equal to 0.5. Now what I want to
do is for this part of the curve as well as for this part of the curve, I want to define
two separate major curves because for this complete curve I can look at this polygon,
this convex hull and decide on the flatness of this curve. But in order to define the
flatness of this curve, I need to find a convex hull corresponding to this curve.
So if I want to format this as a Bezier curve, I need to get the control points for this
curve. So again let's call this as q curve and I need to give four points for this curve.
The first point is the starting point, so q0 will be the same as p0. The last point
is this point, so q3 will be the same as p at 0.5. And now other two point that we will
get will be let's say some points like this and we can show mathematically that q1 will
be p0 by 2 plus p1 by 2. That means if I take this segment, the midpoint of that will be
q1 and similarly this point I can show that to be q2 will be p0 by 4 plus p1 by 2 plus
p2 by 4. That means this point I can find out by a combination of p0 p1 and p2.
And of course q3 is p of o.5, so q3 I can write down the expression for t and we will
get q3 to be equal to p0 by 8 plus 3 times p1 by 8 plus 3 times p2 by 8 plus p3 by 8.
This way we can get q0 q1 q2 and q3 and similarly for the second curve, we can write down the
similar expression symmetrically.
So for this q curve the B matrix would look like p0, p0 by 2 plus p1 by 2, p0 by 4 plus
p1 by 2 plus p2 by 4, p0 by 8 plus 3 p1 by 8 plus 3 p2 by 8 plus p3 by 8. This will be
a B matrix for the q curve. The q curve is the first half of this Bezier curve. So if
we know the control points, if we know these four control points I can decide the flatness
of this curve by looking at this polygon now. If this is flat enough, well and good otherwise
I will again subdivide it further using the similar formulation. Again the basic thing
is the same, for this Bezier curve are subdivide it into two curves which are both Bezier curves
and I found out the control points for both the curves. And for deciding a flatness of
each curve, I'll look at this quadrilateral p0 p1 p2 p3 and some ratio on the height to
the base can be used for finding out the flatness of the curve.
Any question with respective this subdivision of Bezier curves in order to display that.
Yeah this is the point q3. Yeah, we can write down the expression for the Bezier curve,
put u equal to 0.5 and get the value of this curve whereas this point will be obtained
from, this is basically obtained from the one same polynomials. The one same polynomial
we had given in my class earlier, use those polynomial I will get this expression. You
can check on that, they are in accurate representation.
See here essentially this curve is also a cubic curve that this is the part of the same
cubic formulation. Again so these curves will give some accurate representation of this.
If they did not then your display of curves won't be correct. So they will give us an
accurate representation on the curve. Actually this is a respective to Bezier curves.
When we go into B-spline curves, again we are talking of B-spline curves let's say with
k equal to 4. The method for B-spline curves is to going to be similar as for Bezier curves
because B-spline curves are a generalization of the Bezier curve. If we are taking k equal
to 4 and if we have a number of points like this, we know that for the B-spline curves
the convex hull property is stronger than that for Bezier curves. So we know that for
the first four points if we consider this as a convex hull, my curve will lie within
this convex hull, this curve segment. If I take the next curve segment, that will lie
within this convex hull. The curve segment after this will again lie within let's say
within this convex hull and so on. So for k equal to 4, I will be taking 4 successive
points every time and I will get a convex hull which will define the bounds of my curve.
So now I can look at this convex hull and decide whether it is flat enough or not and
continue. In the formulation for the curve within this is again given by set of equation
which we have discussed earlier. If we want to subdivide this part of the curve further,
again we can develop similar equations for this also. The method is the same, the details
you can look up elsewhere. The only thing is in this case we have to be careful of the
fact that every curve segment will be contained within the convex hull of k points. If I take
k successive points, the convex hull of that will contain the curve within it. Sir, in
previous example that you are shown in divide subdividing Bezier curve] that was the specific
for u equal to 0.5 because this thing and I had taken q3 that is to the midpoint of
the curve.
Similarly q1 and q2 that I have got, they are specific for u equal to 0.5. In fact you
can see that easily this point q1 is a midpoint of p0 p1 and we have said that the tangent
of the starting point will be in the direction of the p0 p1 line. It is a since this is a
midpoint but derivative is coming down by half. So this has to be at the 0.5 point.
Any questions up to this point? In that case I will wind up now.
In the next class we will be seeing how to model solids and what are different types
of techniques that are used in solid modeling. The only one thing you should remember, I
think in one of the earlier classes I mention that for B-spline curves, the curve will be
contained within the convex hull of k points on either side of a point that is not correct.
It is contained within a convex hull of k points, not 2 k points. So if I take first
4 points for the k equal to 4 curve, my curve segment corresponding to that will be contained
within that convex hull and that will be true for each any of these successive convex hull.
So that is all for our today.