Registered Member
|
I asked this on SO, but it looks like the question is headed for termination because it doesn't meet their 'rules'. I too am a steward of an open source project -- who seems to be the only one that answers questions. Thanks for all you work on Eigen.
I have a project that spends a lot time evaluating Bezier curves using this De Casteljau implementation in Eigen. As this is the innermost loop for a lot of my work, I'd like it to be as fast as possible. The result is output in the vector p. It has columns based on the dimensionality of the problem (say x,y,z in 3D). The Bezier curve control points are input in the matrix cp. Each control point is a row, the columns match p. A Cubic curve would have four rows. Although higher order curves may occur, cubic is typical, so cp is often 4x3. It starts by creating Q as a copy of cp. The De Casteljau algorithm then operates in-place to calculate q. Is there a faster way to do this in Eigen?
I guess I'm hoping for a way to eliminate the inner for loop, or some other expression template magic... Thanks for any help. |
Registered Member
|
If you only care about the Q.row(0), it's just a linear combination of the rows with binomial coefficients:
where nchoosek(n, k) = factorial(n)/factorial(k)/factorial(n-k) is a function you'll need to write or precompute and store. |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]