brettmorrisonAO5ANNEX / 3D_modeling_animations

0 stars 0 forks source link

Higher Degree Bezier Final Curve Issue #6

Closed brettmorrisonAO5ANNEX closed 5 months ago

brettmorrisonAO5ANNEX commented 6 months ago

For some reason with cubic (and likely higher degrees), the final Bezier curve is slightly different than the actual linear interpolation.

Screenshot 2024-01-15 at 8 57 15 PM

I think it has to do with the fact that I define the path for the rec_interp_1 and rec_interp_2 curves as literal quadratic Bezier curves using sets {P0, P1, P2} and {P1, P2, P3} respectively. In actuality, they may need to follow a slightly different path since the final curve is an affine combination of the two quadratic Bezier curves.

Screenshot 2024-01-15 at 9 04 03 PM
brettmorrisonAO5ANNEX commented 6 months ago

I think the issue might actually just be with the rate the trackers are moving on the different curves. For some reason at t=0.5 (where all trackers should be halfway along their control polygons), the trackers on both of the decomposed quadratic Bezier curves (rec_inter_1 and rec_interp_2) are not quite at the halfway mark. This small difference in progression leads to the unexpected behavior of the final LIVis component.

Screenshot 2024-01-16 at 12 05 25 AM

brettmorrisonAO5ANNEX commented 6 months ago

Looking at the picture above, it appears that the trackers for rec_interp_1 and rec_interp_2 are symmetrical across the center of the screen (not with respect to color, but with respect to the position of the tracker). The expected behavior is to be flipped (which can be observed for all the other LIVis components. This leads me to believe I messed up an endpoint assignment in the pre-animation phase. So it could either be a math issue (as discussed 2x above), a speed issue (as mentioned 1x above), or a point assignment/LIVis creation error in the pre-animation code.

brettmorrisonAO5ANNEX commented 6 months ago

I think the issue is that I am relying on the default settings of the ManimCE function MoveAlongPath, which I believe uses an alpha parameter [0, 1] like t to keep track of the progress of a moving object along the path. I don't understand why it doesn't work since I chose rate_func=linear, which should mean all animations follow the same 't' value throughout the defined run_time=5 duration. However that does not seem to be the case so I may need to figure out a way to still use a global t value or be able to calculate custom values for the run_time parameter to accompany the MoveAlongPath call so they are all following a consistent rate.

brettmorrisonAO5ANNEX commented 5 months ago

I found a Reddit post on r/manim (https://www.reddit.com/r/manim/comments/19b12vg/my_first_ever_manim_project/) that helped me implement the global t needed to sync all animations properly using always_redraw. I was also able to use TracedPath to reveal the Bezier curve:

Screenshot 2024-01-27 at 1 52 26 AM