Skip to main content
gamedev.net
🔒 Locked

Translation needed

Started by MattMcFarland Oct 28, 2005 at 10:30 AM 21 replies 2k views
Original Post
MattMcFarland
MattMcFarland
Could anyone please take some of their time to translate this image above into english?
--------------------------------Royalty-Free Music for your games including freeware games for you to enjoy!www.mattmcfarland.com
taby
taby
It's a pretty straightforward function. Are you familiar at all with Algebra?

The part at the end, tE[0,1] means that the value for t should always be within the set of numbers between 0 through 1 inclusive.

Math symbols

If you can provide a little context, a better explanation can be provided.
MattMcFarland
MattMcFarland
I was never taught math beyond arithmetic. The only algebra I learned was out of programming (I didnt even know it was called alg until years later) and financing job costing, etc.

As far as those symbols go, they are not explained on that website in plain english.

I suffer from dyscalculia which makes math very hard for me to understand unless I know how to explain any form of math in plain english to myself. THIS does NOT mean I am inept to learn math. It simply means that my brain refuses to comprehend math the way you do.

B(t) means what?

Po(1-t)5 means P something (one minus t) to the fifth power..

why?

Explain please explain.
--------------------------------Royalty-Free Music for your games including freeware games for you to enjoy!www.mattmcfarland.com
taby
taby
B is the name of a function, where t is the only parameter (argument). Generally, all possible values for t is called the range of the function B.

The calculation on the right-hand side results in an answer, which belongs in a set called the domain of B.

P are some pre-defined constants (coefficients), since they are not passed along into the function as a parameter.

Each portion of the calculation separated by the + symbols are called terms. You will notice that each term resembles each other, with the obvious differences being the exponent value and the P constant.

Using some arbitrary values, the math works out like this, I believe:

t = 0.5
P0 = 0.0
P1 = 1.0
P2 = 2.0
P3 = 3.0
P4 = 4.0
P5 = 5.0

B(0.5) =

0.0*(1-0.5)^5 +

5*1.0*0.5*(1-0.5)^4 +

10*2.0*0.5^2*(1-0.5)^3 +

10*3.0*0.5^3*(1-0.5)^2 +

5*4.0*0.5^4*(1-0.5)^1 +

5.0*0.5^5



To solve:
1. Perform arithmetic inside of all brackets ( ).
2. Perform all exponetiation, from left to right.
3. Perform all multiplication, from left to right.
4. Perform all addition, from left to right (finally, combining the terms).

I used real numbers for P (ie: 0.0) versus the integer form (ie: 0) to help differentiate between P and the other constants in the function (ie: 5, 4, 3, 2, 1, 10).

[Edited by - taby on October 28, 2005 2:56:58 PM]
NoMonkey
NoMonkey
Doh! That last post was from me.

A few edits for my AP post:

Those were not a series of numbers, they were a *sequence* of numbers. Yes this matters :)

The sentence above the mathematical portion is supposed to t = 1 not t = 2.

Also, the reason I used 1 for t is because the problem specifies that t must be contained in the set of numbers between 0 and 1 inclusive.
MattMcFarland
MattMcFarland
Please allow me to ask a set of questions:


#1)
Why is t allowed only to be 1 or 0? What does that mean?


#2)
What does Exponientation mean?


#3)
If this function were ran chronologically for eternity, and B would = X on a 2D grid, what would happen to X each run?
--------------------------------Royalty-Free Music for your games including freeware games for you to enjoy!www.mattmcfarland.com
NoMonkey
NoMonkey
#1) That is just the definition of the domain of the problem. They could have specified all real numbers if they wanted.

#2) This just means calculate a number to the power of their exponent.

#3) If you have a graphing calculator, just plug the function in there.
kevmo
kevmo
This image is a function for a bezier curve. P0 through P5 are controls points that characterize the curve. The curve is given in parametric form, so B(t) gives the value of the curve at step t. t ranges from 0 to 1, where when t=0 the point on the curve is precisely P0, and when t=1, the point on the curve is precisely P5. For t between 0 and 1, the points on the curve are a weighted average of the other points, where earlier points are weighted heavier for small t, and later points are weighted heavier for large t.

Hope that helps.
MattMcFarland
MattMcFarland
Quote:
Original post by NoMonkey
#1) That is just the definition of the domain of the problem. They could have specified all real numbers if they wanted.

#2) This just means calculate a number to the power of their exponent.

#3) If you have a graphing calculator, just plug the function in there.


1) that is specified at the end with that funny symbol then right?

2) to the power of their exponent? What is the exponent? Is that the answer?

I see ^ everwhere but I do not see a command to exponentiate?

3) ok lets not draw it on a graph, I mean what woudl the value actually be? would it change drastically or subtly?


--------------------------------Royalty-Free Music for your games including freeware games for you to enjoy!www.mattmcfarland.com
Nomad010
Nomad010
Here's some useless information about this function:

If: P0 = P1 = P2 = P3 = P4 = P5 = P
Then: B(t) = P

Quote:
Original Quote by MattMcFarland
Why is t allowed only to be 1 or 0? What does that mean?


It's not only zero and one but also anything inbetween. The reasons for this is that it is probably due to the original context of the formula.

Quote:
Original Quote by MattMcFarland
What does Exponientation mean?


Exponents? It basically means that you take the argument and times it by itself the number of times as the power.

EG: 53 = 5*5*5 = 125

Quote:
Original Quote by MattMcFarland
If this function were ran chronologically for eternity, and B would = X on a 2D grid, what would happen to X each run?


It depends what you mean by this?

If you mean, if we drew B(t) on a graph then it could cut the t-axis anywhere up to five times. It would also cut the y-axis only at P0.

If you mean, if we redefined B(t) each time to include a greater amount of powers and then drew the graph then a lot of things could happen. First of all the pattern is ((1-t) + t)n where every term created has a different constant(P0 to Pn) slotted before it.

EDIT: If you don't about the patterns of the numbers seen in the equation then google "Pascal's Triangle" and "Binomial Expansion."

EDIT2: If you want to make exponents in the thread then use insert numbers here</sup&#62
"..."
kevmo
kevmo
Quote:
Original post by MattMcFarland
a command to exponentiate?


In C++, if you want to compute x^y (x to the power of y), you use pow(x,y).

In Java, it is Math.pow(x,y).

To exponentiate is the same result as repeated multiplication. So, to compute 10^2, you would calculate 10*10. For 10^3, it is 10*10*10, and so on. There are faster ways of computing it than repeated multiplication, which is why you should use the pow() function.
MattMcFarland
MattMcFarland
CONCLUSION:




B(t) is a variable by itself or is B a variable by itself?

P0 is variable 1
P1 is variable 2

and so on..

Ok someone please explain it like this to me.. please, so far you guys havwe been very helpful but this needs to be done:


are p0 to 5 already set?

B =

variable1 plus one minus t multiplied by itself 5 times plus
variable2 plus time with 1 subtracted by time multiplied by itself 3 times plus
variable3 plus 10 multiplied by itself twice plus t multiplied again by itself by 2 plus 1 minus t then multiplied by itself 3 times plus
variable4 plus 10 multiplied by itself three times plus t then multiplied by itself 3 times again then we take 1 minus t and multiply by iteslf 3 times again plus
variable5 plus 5 then multiply itself 4 times then add t then multiply itself by itself again 4 times then add 1 minus t plus
variable6 multiplied by itself 5 times plus t then multipled by itself 5 times.

t starts at 0.0 then ends at t1.0 and is incremented by .01 or something?
--------------------------------Royalty-Free Music for your games including freeware games for you to enjoy!www.mattmcfarland.com
deavik
deavik
This looks like a binomial expansion. To be precise,

the 1, 5, 10, 5, 1 which are coefficients are all 5Cn, 0 <= n <= 5.

I'm curious about this expression, could please tell me where you got it from, Matt?

edit: If you leave out the Pn, this is exactly the binomial expansion of ((1-t) + (t))5 = 15.
MattMcFarland
MattMcFarland
Quote:
Original post by deavik
I'm curious about this expression, could please tell me where you got it from, Matt?

http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Quadratic_B.C3.A9zier_curves

EDIT: I read that whole page, and ended up posting questions here, because I'm trying to learn splines, and the math expressions used in the wikipedia does not compute in my brain whatsoever. It does not speak the language my brain's computer understands :( Therefore I must translate each expression to my language if that makes sense?
--------------------------------Royalty-Free Music for your games including freeware games for you to enjoy!www.mattmcfarland.com
deavik
deavik
From the wiki article:
Quote:
The curve begins at P0 and ends at Pn; this is the so-called endpoint interpolation property.

This sounds like each term in the expression in just weighted according the points controlling the bezier. In fact, I think you'll find the general expression easier to understand:



n, i within a bracket mean nCi, a combinatorial expression. Pi is used (to the best I can think of now) to weight the expression as I said before. (1-t)n-iti is a common term in binomial expansions, there is a link in the article too.

Hope this helps (it took me a lot of trouble to write!),
deavik
deavik
To use in your program, you must have knowledge of n and i. n is the no of control points (I think that's under your control), let i be 0 for now. Of the top of my head, the following functions will help you:

int factorial (int num){    int retval = 1;    for (int i = num; i > 0; i--)    {        retval *= i;    }      return retval;}int nCr (int n, int r){    return (factorial (n) / (factorial (r) * factorial (n - r))); }float expo (float x, int y){    float retval = 1.0f;    for (int i = 0; i < y; i++)    {        retval *= x;    }        return retval;}


Then, all you need to do is:
int b;for (int i = 0; i < n; i++){    b += nCr (n, i) * expo (1-t, n-i) * expo (t, i) * values_of_P ;}
where you have to keep the values of P handy in an array or something.

There, I hope I was able to translate the math to english [wink]!
Zakwayda
Zakwayda
As has been metioned, that's a 5th-degree Bezier curve. You might find it easier to start with a Bezier curve of lower degree, say 2. The function for this looks like:
B(t) = (1-t)<sup>2</sup>P<sub>0</sub>+2t(1-t)P<sub>1</sub>+t<sup>2</sup>P<sub>2</sub>
Written out without the exponent notation:
B(t) = (1-t)*(1-t)*P<sub>0</sub>+2*t*(1-t)*P<sub>1</sub>+t*t*P<sub>2</sub>
And in words:
B(t) =(One minus t) times (one minus t) times P<sub>0</sub> plustwo times t times (one minus t) times P<sub>1</sub> plust * t * P<sub>2</sub>
As you can see, even with words the parentheses are requires to avoid ambiguity.

Both t and Pi are variables (sort of), but in different ways. You are correct that the idea is to 'move' t from 0 to 1 by some step (say, 0.1), and plug it into the above equation at each step. This gives you a series of points which are on the curve. Smaller steps give you more points and a better approximation of the curve; larger steps give you fewer points and a less accurate approximation of the curve.

Technically, the control points (Pi) are constants as far as the function is concerned. Changing the control points basically makes it a different function, one that represents a curve of a different shape than the original.
MattMcFarland
MattMcFarland
basically these are "curve orders" which need to be ran over and over again to execute the curve right? the Pi is basically the points in which the object uses.

Since in code we do not specify time, we specify steps in a loop right? So if it were in a loop, it would need to conduct the mathematics over and over again until the math has reach a certain point?

So lets say I have a 4 point curve. The object executs the curve orders.

Can we make the curve orders relative to the objects execution point? Like if it were to execute the orders at a certain position on the grid, do the points appear at the same spot? Or can they be relative to the objects point?

They would need to be relative I should think.
--------------------------------Royalty-Free Music for your games including freeware games for you to enjoy!www.mattmcfarland.com
taby
taby
Quote:
Original post by Nomad010
Here's some useless information about this function:

If: P0 = P1 = P2 = P3 = P4 = P5 = P
Then: B(t) = P

Quote:
Original Quote by MattMcFarland
Why is t allowed only to be 1 or 0? What does that mean?


It's not only zero and one but also anything inbetween. The reasons for this is that it is probably due to the original context of the formula.

Quote:
Original Quote by MattMcFarland
What does Exponientation mean?


Exponents? It basically means that you take the argument and times it by itself the number of times as the power.

EG: 53 = 5*5*5 = 125

Quote:
Original Quote by MattMcFarland
If this function were ran chronologically for eternity, and B would = X on a 2D grid, what would happen to X each run?


It depends what you mean by this?

If you mean, if we drew B(t) on a graph then it could cut the t-axis anywhere up to five times. It would also cut the y-axis only at P0.

If you mean, if we redefined B(t) each time to include a greater amount of powers and then drew the graph then a lot of things could happen. First of all the pattern is ((1-t) + t)n where every term created has a different constant(P0 to Pn) slotted before it.

EDIT: If you don't about the patterns of the numbers seen in the equation then google "Pascal's Triangle" and "Binomial Expansion."

EDIT2: If you want to make exponents in the thread then use insert numbers here



Thanks for the info!
taby
taby
Quote:
Original post by deavik
From the wiki article:
Quote:
The curve begins at P0 and ends at Pn; this is the so-called endpoint interpolation property.

This sounds like each term in the expression in just weighted according the points controlling the bezier. In fact, I think you'll find the general expression easier to understand:



n, i within a bracket mean nCi, a combinatorial expression. Pi is used (to the best I can think of now) to weight the expression as I said before. (1-t)n-iti is a common term in binomial expansions, there is a link in the article too.

Hope this helps (it took me a lot of trouble to write!),



Nice!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.