Determing t in a Cubic Bezier equation

  • Context: Undergrad 
  • Thread starter Thread starter tabris556
  • Start date Start date
  • Tags Tags
    Cubic
Click For Summary

Discussion Overview

The discussion revolves around the challenges of determining the parameter \( t \) in a cubic Bezier equation for animation purposes. Participants are exploring how to accurately compute values along a Bezier curve based on frame numbers and control points, with a focus on discrepancies between expected and calculated values.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant describes a program that generates cubic Bezier curves and encounters issues when exporting data along the curve, particularly with the values calculated for specific frames.
  • The same participant provides an example with specific control points and notes that the expected value at frame 1 does not match the calculated value when using \( t = 0.1 \), leading to a value of approximately \( t = 0.1199 \) for the correct output.
  • Another participant confirms the control points and calculated values for \( t = 0.1 \), questioning what the expected value range of 0.025 to 0.026 refers to.
  • A participant acknowledges a misunderstanding regarding the use of \( x \) and expresses a need to find \( y \) for a given \( x \), indicating a shift in their approach to solving the problem.
  • Another participant suggests that to find \( y \) from \( x \), one must first solve for \( t \) based on \( x \), which involves solving a cubic equation.
  • A participant expresses interest in the complexity of the problem after receiving assistance.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the method to find \( t \) for a given \( x \) or how to resolve the discrepancies in values. Multiple approaches and understandings are presented, indicating ongoing exploration and debate.

Contextual Notes

The discussion highlights the complexity of solving cubic equations in the context of Bezier curves, particularly when relating frame numbers to parameter values. There are unresolved aspects regarding the specific values and methods to derive \( t \) from \( x \).

tabris556
Messages
4
Reaction score
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.
 
Mathematics news on Phys.org
And let me give a concrete example of what I am seeing. The start point is at (0.0, 0.0). The end point is at (10, 0.88). The first control point is (2.5, 0.0) and the second is (7.5, 0.6387501), sorry about that. So at frame 1 I plug in t =0.1. THe graph show that the value there should be between 0.025 and 0.026 and I do not see that value until t=0.1199. Thanks againl.
 
tabris556 said:
And let me give a concrete example of what I am seeing. The start point is at (0.0, 0.0). The end point is at (10, 0.88). The first control point is (2.5, 0.0) and the second is (7.5, 0.6387501), sorry about that. So at frame 1 I plug in t =0.1. THe graph show that the value there should be between 0.025 and 0.026 and I do not see that value until t=0.1199. Thanks againl.

If I understand your post correctly:

P0 = (0,0)
P1 = (2.5,0)
P2 = (7.5, 0.6387501)
P3 = (10. 0.88)

With those control points, for t = 0.1, x = 0.82 and y = 0.018. When you say the value should be between 0.025 and 0.026, what do you mean? Value of what?
 

Attachments

  • Bez.jpg
    Bez.jpg
    7.2 KB · Views: 459
So I think I have been thinking about this incorrectly. Hotvette you are correct with t = 0.1, x = 0.82 and y = 0.018. What I guess I need to figure out it a way to solve for y when x=1. I have been thinking about this incorrectly and trying to not use x correctly but I need that. So how would I be able to get y or t for a given x? In my situation x is actually a frame number and so I need to figure out the y value at a given frame.
 
If you know x and want the value of y, I believe you need to solve for t based on the given value of x, then calculate y based on t. To find t, though, you need to solve a cubic equation.
 
Last edited:
Yeah I think you are right. This just got a lot more interesting for me. Thanks for the help hotvette
 

Similar threads

Replies
9
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
13K
  • · Replies 5 ·
Replies
5
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K