Fix Bezier Curve Errors with Colinear Points#799
Fix Bezier Curve Errors with Colinear Points#799danieldouglas92 wants to merge 5 commits intoGeodynamicWorldBuilder:mainfrom
Conversation
b4d044c to
dcd65dc
Compare
|
a9ea923 to
b8cec55
Compare
|
At this point I think the code that I have is correct, there was an issue with the existing implementation of the Bezier curve when dealing with points that were co-linear. If you have points P1 and P2, to compute the Bezier curve two additional control points CP1 and CP2 must be determined which control the shape of the curve. Sometimes, the control points would be outside of the bounds of Points P1 and P2, as illustrated below: x----o--------x----o However, the control points should lie within on the vector P1P2, not beyond it, like this: This is important because when the control points lie beyond the vector P1P2, the arclength of the Bezier curve is artificially made longer. Currently, some of the tests are still failing but they are mostly related to tests which utilize coordinates that are colinear (with the exception of the test |
MFraters
left a comment
There was a problem hiding this comment.
This looks good to me. thanks for finding and fixing the bug! I have a few small comments, but otherwise I think it is good to go.
8bc48f0 to
f99409b
Compare
|
Thanks for the review! I've addressed your comments, it turns out it wasn't |
|
After talking to @MFraters I've tentatively updated the test results. The test results should be more correct now, because the tests that were failing involved colinear points. However, we want to do a little more checking to make sure that the new code still produces correct results, so do not merge this quite yet. |
95536e3 to
b178283
Compare
|
Finally returning to this to check the output from the tests that were failing to confirm that things look good with the changes in this branch. Good news is that the changes in this branch actually improve the output! Below are screenshots comparing the output from 4 tests that were failing on the main branch, and on the changes in this branch. Here is the test
Here is the test
Here is the test
However, from a side view this is how the main branch compares with the changes in this branch.
Lastly, here is the comparison for
For 3 of the 4 tests, the tests prior to this change produce features that are disjointed/discontinuous, and the changes within this branch certainly fix that. For the Thoughts on this and these comparisons @MFraters? |
b178283 to
09968fe
Compare
|
I've fixed the merge conflicts and I'll fix the broken tests sometime tomorrow. |
|
Thanks! It does seem to fix #861, but I need to look at bit more at it to remember what this pull request is doing. I will have another look at it this Friday. |
389dc2f to
5ff3258
Compare
So, does the issue disappear when you use values on the same order of magnitude and/or change it to: |
MFraters
left a comment
There was a problem hiding this comment.
Generally looks good, although these are kind of two different pull requests in one. I am fine with that, but please split it up in the changelog.
Can you remind me why you need the arclength?
Can you maybe add a test of a bezier curve of which you know the arc length, to make sure the function actually computes a reasonable length?
|
@MFraters Thanks for taking a look at this again. The bezier curve length was something that was needed for the contours implementation that we were working on at the Hackathon (PR #829), and since (as you said) it actually doesn't do anything in this PR I think I'll remove the the total arclength from this PR and save that for a follow up PR. |
b284b37 to
f51519e
Compare
|
@MFraters The slab gap introduced in the
this set of coordinates works perfectly fine for both the current main and this branch, since these points are not colinear. Just as a reference, this is what the slab looks like when the trench is [0,0],[50e3,50e3],[125e3,75e3]:
If I make the multiply some of the coordinates by 1000 so that they are all on the order of km's instead of m's: then the slab gap is still present:
The slab gap only seems to be removed depending on the placement of trench coordinates around the trench-kink point at I need to double check the code, but I suspect that this is due to the changes here overconstraining the bezier curve on either side of this kink point. |














Add the functionality within
bezier_curve.ccto determine the total arc-length of the bezier curve across all user-specified coordinates, and the length of the bezier curve between each incremental pair of user-specified coordinates.