you can iteratively merge the segments because you have all the information required already encoded in the segments:
For every 2 segments you're merging, all we need to know is the t value, which is a/(a+b) (where a is the length of the first segment's end point to its associated control point and b is the length of the second segment's start point to its associated control point). Now all you have to do is scale the first segment's first control point, and the second segment's second control point along their respective tangents, to correct for their t value. If the length of the first segment's start-control is l then the length in the merged curve is (a+b)*l/a, and if the length of the second segment's control-end is k then the length in the merged curve is (a+b)*k/b.
And for a curve that got reduced to more than 2 segments, you simply iteratively repeat this process.
you can iteratively merge the segments because you have all the information required already encoded in the segments:
For every 2 segments you're merging, all we need to know is the
t
value, which isa/(a+b)
(wherea
is the length of the first segment's end point to its associated control point andb
is the length of the second segment's start point to its associated control point). Now all you have to do is scale the first segment's first control point, and the second segment's second control point along their respective tangents, to correct for theirt
value. If the length of the first segment's start-control isl
then the length in the merged curve is(a+b)*l/a
, and if the length of the second segment's control-end isk
then the length in the merged curve is(a+b)*k/b
.And for a curve that got reduced to more than 2 segments, you simply iteratively repeat this process.