You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all many thanks for your time and efforts!
I would like to ask about how to implement the known end slopes boundary conditions into the curve fitting using the least squares.
Suppose I have a collection of points and I would like to best fit a Bezier curve of a given degree to these points. Suppose, also, I would like to treat the first and the last point as actual first and last control points. Starting from the error definition in matrix notation
E(C) = (P - TMC)^T (P - TMC)
d(E(C))/dC = -2(TM)^T (P - TMC) <--- your equation lacks M^T
after rearrangement and abbreviating TM as b, we get
b^T bC = b^T P.
Let's define b^T b => B and b^T P => A, such that we now have
BC = A.
If C(1) and C(end) are known, we get
B(2:end-1, 2:end-1)C(2:end-1) = A(2:end-1) - C(1)B(2:end-1,1) - C(end)B(2:end-1,end)
and finally
C(2:end-1) = B(2:end-1, 2:end-1)C(2:end-1)^-1 [A(2:end-1) - C(1)B(:,1) - C(end)B(:,end)]
This works like a charm. However, I don't understand how to derive/implement the slope conditions (let say in the form of unit tangents) at the first and last points...
Would really appreciate your thoughts on this.
Victor
The text was updated successfully, but these errors were encountered:
Hi Pomax,
first of all many thanks for your time and efforts!
I would like to ask about how to implement the known end slopes boundary conditions into the curve fitting using the least squares.
Suppose I have a collection of points and I would like to best fit a Bezier curve of a given degree to these points. Suppose, also, I would like to treat the first and the last point as actual first and last control points. Starting from the error definition in matrix notation
E(C) = (P - TMC)^T (P - TMC)
d(E(C))/dC = -2(TM)^T (P - TMC) <--- your equation lacks M^T
after rearrangement and abbreviating TM as b, we get
b^T bC = b^T P.
Let's define b^T b => B and b^T P => A, such that we now have
BC = A.
If C(1) and C(end) are known, we get
B(2:end-1, 2:end-1)C(2:end-1) = A(2:end-1) - C(1)B(2:end-1,1) - C(end)B(2:end-1,end)
and finally
C(2:end-1) = B(2:end-1, 2:end-1)C(2:end-1)^-1 [A(2:end-1) - C(1)B(:,1) - C(end)B(:,end)]
This works like a charm. However, I don't understand how to derive/implement the slope conditions (let say in the form of unit tangents) at the first and last points...
Would really appreciate your thoughts on this.
Victor
The text was updated successfully, but these errors were encountered: