Hey all, trying to figure out how to do bezier interpolations.

I'm given the following data

input values - scalars

output values - scalars

intangents - 2D vector (x, y)

outtangents - 2D vector (x, y)

The collada book says that the 4 points can be calculated as follows

c(0) = (K1, V1)

c(1) = ((2K1 + K2)/3, V1 + outTangent(T0))

c(2) = ((K1 + 2K2)/3, V1 - inTangent(T1))

c(3) = (K2, V2)

I believe that k1 is the nearest low input value and k2 is the nearest high input value to our current input value (time) that falls inbetween them. V1 and V2 are the respective output values to K1 and K2.

For the first animation node in the astroboy file the output values are a single float value, where as the intangent and outtangent are 2D vectors (x, y).

Therefore, what does it mean to add a scalar value (V1) to a 2D vector (T0)?

Thanks guys!

# Bezier interpolation (Animation)

Page 1 of 1## 7 Replies - 10960 Views - Last Post: 28 June 2011 - 02:51 PM

##
**Replies To:** Bezier interpolation (Animation)

### #2

## Re: Bezier interpolation (Animation)

Posted 27 June 2011 - 12:46 PM

There isn't enough information there. From what you have shown so far c(0) is the first control point in 2D space and c(3) the last for the control points of your quadratic Bezier Curve. The formulae are applied such that the existing mid-points c(1) and c(2) are inputs to the functions to form your curve, so the further from the start and end points you move the mid-points, the more abstracted away from a straight line your curve will be, so you should be seeing it as something like:

Now, i don't know what is defined for functions outTangent() and inTangent(), but they will be the crux of what drives the interpolation functionality.

Quote

c(0) = (x1, y1)

c(1) = ((2(x1) + x2)/3, y1 + outTangent(T0))

c(2) = ((x1 + 2(y2))/3, y1 - inTangent(T1))

c(3) = (x2, y2)

c(1) = ((2(x1) + x2)/3, y1 + outTangent(T0))

c(2) = ((x1 + 2(y2))/3, y1 - inTangent(T1))

c(3) = (x2, y2)

Now, i don't know what is defined for functions outTangent() and inTangent(), but they will be the crux of what drives the interpolation functionality.

### #3

## Re: Bezier interpolation (Animation)

Posted 27 June 2011 - 01:36 PM

Achilles4689, on 26 June 2011 - 10:26 PM, said:

Hey all, trying to figure out how to do bezier interpolations.

I'm given the following data

input values - scalars

output values - scalars

intangents - 2D vector (x, y)

outtangents - 2D vector (x, y)

The collada book says that the 4 points can be calculated as follows

c(0) = (K1, V1)

c(1) = ((2K1 + K2)/3, V1 + outTangent(T0))

c(2) = ((K1 + 2K2)/3, V1 - inTangent(T1))

c(3) = (K2, V2)

I believe that k1 is the nearest low input value and k2 is the nearest high input value to our current input value (time) that falls inbetween them. V1 and V2 are the respective output values to K1 and K2.

For the first animation node in the astroboy file the output values are a single float value, where as the intangent and outtangent are 2D vectors (x, y).

Therefore, what does it mean to add a scalar value (V1) to a 2D vector (T0)?

Thanks guys!

I'm given the following data

input values - scalars

output values - scalars

intangents - 2D vector (x, y)

outtangents - 2D vector (x, y)

The collada book says that the 4 points can be calculated as follows

c(0) = (K1, V1)

c(1) = ((2K1 + K2)/3, V1 + outTangent(T0))

c(2) = ((K1 + 2K2)/3, V1 - inTangent(T1))

c(3) = (K2, V2)

I believe that k1 is the nearest low input value and k2 is the nearest high input value to our current input value (time) that falls inbetween them. V1 and V2 are the respective output values to K1 and K2.

For the first animation node in the astroboy file the output values are a single float value, where as the intangent and outtangent are 2D vectors (x, y).

Therefore, what does it mean to add a scalar value (V1) to a 2D vector (T0)?

Thanks guys!

To answer you question "Therefore, what does it mean to add a scalar value (V1) to a 2D vector (T0)? " I believe it means component wise addition.

V1 + T0 == (V1 + T0.x && V1 + T0.y)

### #4

## Re: Bezier interpolation (Animation)

Posted 27 June 2011 - 05:23 PM

Thanks for the replies guys. I've found a little more information. Evidently the collada book was wrong and on their wiki errata it states that for 1D tangents the equation for the 4 control points will be

c(0) = (K1, V1)

c(1) = ((2K1 + K2)/3, V1 + (outTangent/3))

c(2) = ((K1 + 2K2)/3, V2 - (inTangent/3))

c(3) = (K2, V2)

The problem is that I also need to know how to calculate the control points for 2D tangents and I do not know how they got to the above equations.

I even have books that cover cubic bezier curves but I'm still having trouble fitting everything together. Eric Lengyel's book states that:

C1 = C0 + (T1/3)

C2 = C3 - (T2/3)

where T1 and T2 are the outtangent and intangent respectively. If one is dealing with 3D tangents this is fine, but I don't believe the relations hold for 2D and 1D tangents, hence the different original equation for 1D tangent.

If anyone could help me make sense of this I would really appreciate it. I swear I've read through 10 different books/papers on bezier curves and still can't figure out the answer. =(

c(0) = (K1, V1)

c(1) = ((2K1 + K2)/3, V1 + (outTangent/3))

c(2) = ((K1 + 2K2)/3, V2 - (inTangent/3))

c(3) = (K2, V2)

The problem is that I also need to know how to calculate the control points for 2D tangents and I do not know how they got to the above equations.

I even have books that cover cubic bezier curves but I'm still having trouble fitting everything together. Eric Lengyel's book states that:

C1 = C0 + (T1/3)

C2 = C3 - (T2/3)

where T1 and T2 are the outtangent and intangent respectively. If one is dealing with 3D tangents this is fine, but I don't believe the relations hold for 2D and 1D tangents, hence the different original equation for 1D tangent.

If anyone could help me make sense of this I would really appreciate it. I swear I've read through 10 different books/papers on bezier curves and still can't figure out the answer. =(

### #5

## Re: Bezier interpolation (Animation)

Posted 28 June 2011 - 08:02 AM

The reason why you can't understand it is because you haven't learned the theory. You will have to do it eventually, so I strongly suggest that you read up on Bezier Curves and interpolation - as well as look at DirectX/OpenGL implementations that will show you explicitly how it is coded.

### #6

## Re: Bezier interpolation (Animation)

Posted 28 June 2011 - 11:07 AM

Are we looking on page 125? If so I think your equations need to be updated.

### #7

## Re: Bezier interpolation (Animation)

Posted 28 June 2011 - 12:37 PM

Yeah, in my second post I posted the correct formula.

I understand the theory...

You have an initial point p0 that is the start of the curve and you have a final point (for cubic its p3) that is the end of the curve. Then you have two control points p1 and p2 that influence the curve but are not actually lying on the curve. I also know that the formula for calculating the tangents is done by taking the derivative at t=0 and t=1.

As I've stated, I have read through quite a few different books about bezier curves, but all of them assume that we know all 4 control points. In the format collada gives one must calculate the control points from the data given. This is where my problem lies.

I understand the theory...

You have an initial point p0 that is the start of the curve and you have a final point (for cubic its p3) that is the end of the curve. Then you have two control points p1 and p2 that influence the curve but are not actually lying on the curve. I also know that the formula for calculating the tangents is done by taking the derivative at t=0 and t=1.

As I've stated, I have read through quite a few different books about bezier curves, but all of them assume that we know all 4 control points. In the format collada gives one must calculate the control points from the data given. This is where my problem lies.

### #8

## Re: Bezier interpolation (Animation)

Posted 28 June 2011 - 02:51 PM

I've figured out the solution. Thanks.

Page 1 of 1