# Bezier interpolation

Hi all.
I’m developing an 3D Studio MAX export to get the animation keys for use in my 3D Engine. The problem is that I don’t know how to use the Bezier Position Keys. This keys are defined by: InitialPosition(Vector3D) FinalPosition(Vector3D) InTangent(Vector3D) OutTan(Vector3D). Now I only make a simple linear interpolation between the Initial and final position. How I can use the InTan and OutTan parameters?. I read some examples about bezier interpolation but this use 2 points (Initial, End) and other 2 control point. How I can convert this tangents to controls points?.
Thank to all.

Control point 1 = InitialPosition + InTangent * Scale
Control point 2 = EndPosition + EndTangent * Scale

…where Scale determines how strongly the tangent influences the curve. Depending on how they are defined you might need to replace one or both ‘+’ with ‘-’.
http://astronomy.swin.edu.au/~pbourke/curves/bezier/

Thanks I will go to try this one. But about the Scale factor, do you know how I can export this one from 3D Studio MAX? thank you

Originally posted by KILE:
[b]Thanks I will go to try this one. But about the Scale factor, do you know how I can export this one from 3D Studio MAX? thank you[/b]

'Fraid not. Basically it just affects the “strength” of the tangent as the ends of the curve. The URL I supplied talks about this I think.

Don’t quote me on this. In all my experience with max exports I have never gotten around to exporting bezier tracks but this is my guess about the scale. Max doesn’t store a scale but i believe it will let the tangents (or more specifically the lines that represent the tangents) be of arbitrary length. All I mean is that the scale is the length of the tangent. Whether its a vector or 2 endpoints of a line it makes no difference. I don’t know this for sure but this is my guess.

Devulon

Now getting the scale is really tricky from max, You cant just use the tangents and interpolate as the tangents are too small and u’ll probably landup interpolating almost linearly with those tangent values. Somehere in the max documentation i saw that the scale is (DeltaT/3) where DeltaT is the time differebce between two Keys, but this does not work correctly. I have used 3*DeltaT but this closely approximates, but does not accurately give you Max’s interpolation. Please do let me know if things work for you or you could get the scale factor.

-Sundar

Sundy can you post your code. You said that this run but not as well as MAX. I want to see what you do 