algorithmmathphysicsbezier

Gradient Of Bezier Curve At Given Point


I cant seem to figure out how to calculate the incline of a curve for the following situation...

Essentially what I am trying to do is increase the speed of an object based on the incline of the curve at a particular point. The speed will be reduced if the incline is upwards and increase if downward.

I was using the derivative of a point t on the bezier curve to establish the tangent but this doesnt seem to be right as I would expect that value to be negative if the slope is downward.

I have been using the below equation for the tangent to evaluate X, Y and Z but then I only use Y to establish the incline...I think that step may be wrong

enter image description here

Any ideas?

EDIT:

Ultimately this is an object moving along an inclined plane but I cant establish the angle of the plane in order to do this, I believe if I could correctly find the angle it may solve the problem. I tried to take the point in question and then another point in front (so for example t = 0.5 and then a point in front would be t=0.51) and then calculate the angle using tan. I completely ignore the Z axis but is that wrong? If not how should I calculate the angle?

Thanks a lot


Solution

  • This should help: Physics Classroom: Inclined Planes.

    Essentially, you need to calculate the angle of inclination. If the angle is ϴ, then the acceleration depends on sin(ϴ).

    I am assuming z as the vertical dimension.

    If dx, dy, and dz are the gradients in each direction, dw = sqrt( dx^2+dy^2). ϴ = arctan(dz/dw). Acceleration = g*sin(ϴ).

    NOTE: You can directly calculate sin(ϴ) without explicitly calculating ϴ: sin(ϴ) = dz/sqrt(dx^2+dy^2+dz^2).

    === More formal description ===

    Let x be the east-west dimension, y be the north-south dimension and z be the up-down dimension.

    Let z = F(x,y) give the elevation of the terrain at any given location x,y.

    Calculate dz/dx = fx(x,y) and dz/dy = fy(x,y), the partial derivatives of z w.r.t. x and y.

    Now, sin(ϴ) = dz/sqrt(dx^2+dy^2+dz^2) = 1/(sqrt( (dx/dz)^2+ (dy/dz)^2 )= 1/(sqrt( (1/fx(x,y))^2, (1/fy(x,y))^2 ).

    This is how you calculate sin(ϴ).