0
101 Jan 17, 2009 at 19:04

Hello,
I am studying Compter Graphics, and I have a task that I have to do, but I am stuck:
I have this curve

That was generated with Lagrange.
with the points:
p0=(-2,0)
p1=(-1,0)
p2=(0,3)
p3=(1,0)
p4=(2,0)
and
u0=0
u1=1/4
u2=1/2
u3=3/4
u4=1

What I have to do is: calculate the points to generate a curve that matches this one, but using Bézier. Like this picture:

But I don’t know exactly the points. How can I calculate it?

Also I have to do the oposite: I have a curve with Bézier and I have to generate a curve with lagrange to match the curve with Bézier.

Thank you,
Oscar

10 Replies

Please log in or register to post a reply.

0
167 Jan 17, 2009 at 22:46

Hi Oscar,

Please be aware that we don’t normally answer ‘homework questions’ on this site. If this is a task for a class, you should consult your professor and/or classmates for help.

0
101 Jan 18, 2009 at 10:23

Hi,
I know that in the site you don’t do homework for others. But I think that answering questions that we may have when doing the homework is not something bad. And this is exactaly what I want: just some help so I can start, because now I am stuck, I don’t want anybody doing this calculation for me.
If It is possible to be done (answering these questions) I would be very happy. If it is not, I understand.

Thank you,
Oscar

0
119 Jan 18, 2009 at 11:53

If you want help, you have to show that you’re trying to solve it yourself, and not just ask for the solution. In other words, ask smarter questions.

Often you’ll find that when you find the correct questions to ask, the answer is trivial.

“How can I calculate it?” isn’t smart enough.

0
101 Jan 18, 2009 at 12:47

Ok, I don’t know how to start it, I am stuck.
I will keep trying to go further and when I get something I will come back.

Thank you :)
Oscar

0
101 Jan 18, 2009 at 18:14

Hey, it is me again.
So I spent the aftoernoon looking for some answer but I cound’t find. I will not list everything that I tried, but I got to no place, I will exaplain two solutions that I am planning to work into. But before, one question:
I have this “formula”:

What exactly it means for (1-t)\^3 or t\^3? I just didn’t understand.

Ok, now what I’m planning to do:
for some of the previous exercises I had to calculate the transformation matrix from Monomial to bezier basis:

and also calculated the monomial to lagrange basis.

As far as I understood, if I have the monomial to bezier matrix, I can calculate the bezier to monomial matrix this way:

So, will it work if, to go to Bezier to Lagrange I multiply
TM<-B * TL<-M ?

and to go from Lagrange to Bezier I multiply:
TM<-L * TB<-M?

Does that make sense?

If this assumption is incorrect, my other idea is to find the points where the tangent signal changes in the graphic and then using this points to try to calculate the control points. Does it make sense?

Thank you,
Oscar

0
101 Jan 18, 2009 at 21:51

@oscarfh

Hey, it is me again.
So I spent the aftoernoon looking for some answer but I cound’t find. I will not list everything that I tried, but I got to no place, I will exaplain two solutions that I am planning to work into. But before, one question:
I have this “formula”:

What exactly it means for (1-t)\^3 or t\^3? I just didn’t understood.

TBH I’m lost as to how you can calculate a spline basis transform and not understand some pretty basic polynomials … So I’m assuming you’ve not explained your question very well.

t is just the spline interpolator. Vary the t from 0 -> 1 and you get the points along the curve (0 is the start, 1 is the end). plug in the t value and you get your positions back.

Its quite possible that you are getting confused between the parametric form and the basis matrix.

The wikipedia page on bezier curves is very informative … I’m shocked you haven’t read through it.

Ok, now what I’m planning to do:
for some of the previous exercises I had to calculate the transformation matrix from Monomial to bezier basis:

and also calculated the monomial to lagrange basis.

As far as I understood, if I have the monomial to bezier matrix, I can calculate the bezier to monomial matrix this way:

So, will it work if, to go to Bezier to Lagrange I multiply
TM<-B * TL<-M ?

and to go from Lagrange to Bezier I multiply:
TM<-L * TB<-M?

Does that make sense?

If this assumption is incorrect, my other idea is to find the points where the tangent signal changes in the graphic and then using this points to try to calculate the control points. Does it make sense?

Yup .. that makes perfect sense. Though bear in mind that the order of multiplications changes if you are using column major over row major matrices. Pretty easy to test it out and see what happens though ;)

0
101 Jan 19, 2009 at 00:48

Ok, this is what I have until now:
with the points:
p0=(-2,0)
p1=(-1,0)
p2=(0,3)
p3=(1,0)
p4=(2,0)
and
u0=0
u1=1/4
u2=1/2
u3=3/4
u4=1

With that I got:
I used this formula to calculate Bézier Matrix:

with

With that, I got:

Also:

And then the matrix:

For Lagrange I have this formula:

And then got these results:

Which led me to this matrix:

As long as:

then:

and

then I used these formulas:

(Is the order correct? How can I check it?)

And got these results:

and

-I am not sure if the order of the multiplication of the matrixes is correct. how can I check it?
-One thing that I noticed is: if you sum the elements inside the lines for the matrixes TL<-M and TB<-M, except for the last line, it will always result 0. Is it a property or something?
-And the last question: from the matrixes TB<-L and TL<-B I can get some equations. But how can I, from these equations or form the matrix, get the control points?

thank you again for your help,
Oscar

0
101 Jan 19, 2009 at 01:25

Yea - I know I’m running into the risk to confuse you even more, but I think you can do easier. I only had a brief look at your approach and it seems okay, but how about this:

You’ve converted your points to a lagrande polynomial. This polynomial can be written in the standard form. e.g.

f(x) = a*x\^4 + b*x\^3 + c*x\^2 + d*x + e (shown for order 4).

Now you want to have a bezier curve for that polynomial.

I could be wrong, but I think all you have to do is to project the polynomial onto the bernstein-polynomials and you get your bezier coefficients out. No matrices involved.

That “project onto polynomial” thing sounds super mathematical, but it’s easy in practice. If I remember right it was just applied polynomial division.

Guys, any idea if this works? I’m unsure myself (just thinking out loud).

0
167 Jan 19, 2009 at 02:44

It sounds reasonable to me. But projection onto a basis of Bernstein polynomials can be just as well expressed with matrices as with polynomial division, since polynomials can be seen as a vector space, and projection as a matrix operation on that vector space.

0
101 Jan 19, 2009 at 12:22

Hi,
Let me show what I understood and did.
First of all, I defined the polynomials in the form:

Then I tried to divide each “section” from Lagrange by Bezier:
(By section I mean the x0 is one sextion, the x1 another and so on):

It is not matching what I have, I will keep on trying to understand it.
But I can get a polynomial by the matrixes calculated in the last post. But what would I do with it? How would I get the points?

What I did was to get from the TB<-L matrix the first row, which is related to the X0.
Then I got these equations

Theretically it would give me the “new X0”, in the bezier formula to fit the lagrange curve, but I don’t know the values for t!

thank you,
Oscar