- #1
tabris556
- 4
- 0
Hi Everyone, so I am having a small situation with cubic bezier curves and I must be missing something. I have generated a program in c# that allows a user to create curves over time and to edit them with control points as they see fit. I have gotten to the point where I am trying to export the data along the curve and this is where I am seeing problems now.
This is for animations and so the window that an individual sees is based on frames and an FPS that the user can set. The issue that I am seeing is what my graph displays and what I am seeing in code for the values that are being calculated. I will give an example.
Lets say I set up a curve that starts at Frame 0 and goes to Frame 10. At frame one along the curve in my graph I see that the value should be at 0.5, I am just making up these values to show my point. Now when I go into my code and use the cubic bezier equation
B(t) = (1-t)^3*P0 + 3*t(1-t)^2*P1 + 3*t^2*(1-t)*P2 + t^3*P3, I am trying to solve for what B should be at each frame. I assumed I just had to take each frame and convert it from total distance to fit into 0-1. So for frame 1 I am using 0.1. When I plug the value 0.1 in I see a noticeably different value. I have done some testing and see that I get the actual value for Frame 1 when t = approximately 0.1199. This has been bugging me for some time and so I have used several different equations to verify this including the Bezier equation above and De Casteljau's equation to solve at t. I am getting the same answer for everything.
I also know that the graph is drawing correctly because the values at the end points are in the correct location.
My question to everyone is what am I missing and where does that value come from? Thank you to all.
This is for animations and so the window that an individual sees is based on frames and an FPS that the user can set. The issue that I am seeing is what my graph displays and what I am seeing in code for the values that are being calculated. I will give an example.
Lets say I set up a curve that starts at Frame 0 and goes to Frame 10. At frame one along the curve in my graph I see that the value should be at 0.5, I am just making up these values to show my point. Now when I go into my code and use the cubic bezier equation
B(t) = (1-t)^3*P0 + 3*t(1-t)^2*P1 + 3*t^2*(1-t)*P2 + t^3*P3, I am trying to solve for what B should be at each frame. I assumed I just had to take each frame and convert it from total distance to fit into 0-1. So for frame 1 I am using 0.1. When I plug the value 0.1 in I see a noticeably different value. I have done some testing and see that I get the actual value for Frame 1 when t = approximately 0.1199. This has been bugging me for some time and so I have used several different equations to verify this including the Bezier equation above and De Casteljau's equation to solve at t. I am getting the same answer for everything.
I also know that the graph is drawing correctly because the values at the end points are in the correct location.
My question to everyone is what am I missing and where does that value come from? Thank you to all.