# [Solved] Catmull-Rom bug

Hey all. I think I found a bug with the Catmull-Rom algorithm used in FastMath. I’ll post some code tonight to illustrate the issue but I think just me explaining what’s going on should be easy enough to understand.

I have 4 vectors that link together in a straight line along the Z axis beginning at 1,1,0 and increasing the Z position by 1 unit, like so:

A–>B–>C–>D

I apply Catmull-Rom to the entire thing going long the plotted curve between B and C increasing the U value by 0.1f each time. This should create a point at B and then 10 others with the last one on C.

And that’s where the bug is.

The last point ends up back at the origin of the scene 0,0,0 not at the end of the curve at C.

Weird right?

Edit: Essentially what the issue is is that while u=0 returns the B vector a u=1 doesn’t return the C vector but one at 0,0,0.

1 Like

mhh… yeah a test case could help.

2 Likes

… Well I have no idea what I’ve done differently but I can’t reproduce in isolated code. Must be a PEBCAC issue.

Sorry to waste everyone’s time.

np, if you ever get it again, revive this thread.

1 Like

Thanks. Will do. Little ticked at myself honestly. I had hoped I’d FINALLY get to submit a useful bug and solution into JME.

I’ll get you next time Gadget! /me shakes tiny fist.

1 Like

May the code gods keep you continuously frustrated.

3 Likes

Ok. I know I have nothing NEW to add to this one but Holy smokes I’m having a mentally off day on this one.

I have a check in my code for null vertices being created (this is only for testing stuff).

But instead of putting it all around the entire chunk of code that’d render a sphere on at that vertice (or lack thereof) I only put it around the part that moves it to the location of the vertice. So ya. I was busy rendering spheres onto at 0,0,0 because there was no vertice to move it.

ugh.

1 Like