Bezier curve I dont understand this thing

Hey,

before you say anything I understand everything about the bezier curve. But since we going in programming it is a bit hard for me to understand.

I am struggling at this part (it is red drawn):

I just dont understand this part:

I now every equation of bezier curve like the linear Bezier curve, quadratic bezier curve, cubic bezier curve, and also the advanced bezier curve so please dont explain.

I mean normally people would say, ah okey that a function I need to use everytime. But I want understand deeply what this function does.

Again: “We are then taking the two points…” what the hell??? where the two points created by wich one? I didnt understand the whole sentence??

I don’t know anything about Bezier curves either but I think I understand what is being said here.

Essentially: you’re creating three points anywhere, so where they’re created is on you. Point 0 is your start point, Point 2 is your end point and I suppose Point 1 determines the intensity of the curve. The gray lines are there to show how lerp is applied in creating the curve and why you need three points.

When it comes to the lerp function’s involvement here, you’re lerping across two lines: Point 0 → Point 1 and Point 1 → Point 2. Your t value (the alpha between a and b in the lerp) is used in both because what you’re effectively doing is inversely between both lines in order to create the curve: up on P0-P1 and down on P1-P2. You’ll see the curve being created as more points are created along each line.

The third lerp creates a line between the two points from the earlier two lerps which gets a point on the curve. So all in all, you’re just creating many lines and getting points on them to create a curve all while using the same alpha value: up on P0-P1, down on P1-P2 and across after joining the lines.

Does this help you make a bit more sense out of the explanation or…?

I understood what the function quadBezier does but I didnt understood what the lerp function does. I mean, I understood it a bit better but could you just go on with the lerp. what is “(b-a)” do? why coudnt I write a - b. I think we write a + (b-a) because of the next points.

I think because we want find the points on it

yes this explanation should make sense of me.

So I can understand it better because

return a + (b - a) * t

shows us that must be the b1/0 or b1/1 or b1/2

can somoene confirm that? then I can make it as solution. Anyways there isnt a better describe of what a + (b-a) * t is doing, or am I wrong?

Yes that must be right what I said because we can see that againat lerp 11, 12 so we created 2, 4 points or something like that.

Oh, I think I get you. Is it specifically the math of the lerp function that’s confusing you? First thing I should mention is that lerp is short for linear interpolation.

Think of lerping as trying to get a percentage between two points. You have three variables:

  • a represents your first value, a minimum
  • b represents your second value, a maximum
  • c is a decimal value typically in the range [0, 1]

c is basically meant to be a percentage between these two values. a is returned when c is 0, b is returned when c is 1 and the middle value between a and b is returned when c is 0.5; therefore, c helps you find midpoints between your minimum and maximum.

The math here is that you’re offsetting a by a certain value, which is the remaining value required for a to reach b. For 50 to reach 100, we need 50 more value, which is where the (b - a) part comes from (100 - 50 = 50). The c value helps adjust the remaining value like a percentage: say our c value is at 0.5 (we’re lerping 50% between 50 and 100). The remaining value needed is 50. 50% of 50 is 25 (50 * 0.5 = 25). This is added to a and then returned (50 + 25 = 75). So we’re 50% between 50 and 100 which is 75.

This help?

1 Like

This is more well explained thanks, but I think my way to do it would it do too.

These are the two points “created”

1 Like