Derivative of a Bezier curve in matrix form

45 views
Skip to first unread message

vince touache

unread,
Mar 8, 2021, 10:36:16 AMMar 8
to Python Programming for Autodesk Maya
hi all, 

I'm working with some bezier curves (ultimately, the goal is to benchmark maya bifrost against regular maya - if you have any reference to share, regarding bifrost perfs, feel free!).
I get my pos at parameter using directly matrices, no decasteljau involved, I find it more elegant:
v_t = np.array([1, t, t**2, t**3])
cubic = np.array([
    [ 1.,  0.,  0.,  0.],
    [-3.,  3.,  0.,  0.],
    [ 3., -6.,  3.,  0.],
    [-1.,  3., -3.,  1.]
])
pos_at_param = np.dot(np.dot(v_t, cubic),  control_points)

Works just fine. But I would like to compute my tangents using the same logic

Whether I start from 
(1-t)**3 + 
3(1-t)**2t + 
3(1-t)t**2 + 
t**3
gets all those derivatives, and recreate a matrix out of it,

or start from the derivative I found online
3(1-t)(1-t) * (p1 - p0) + 
6t(1-t) * (p2 - p1) + 
3tt * (p3 - p2)
giving me 
  [ 3.,  0., 0.]
  [-6.,  6., 0.]
  [ 3., -5., 3.]

None of those seem to give me the actual derivative / tangent vector on my curve at the given param. Am I doing something? Is it simply impossible to compute the tangent of a curve using the same logic than the position?

Thank you


Reply all
Reply to author
Forward
0 new messages