CatmullRom3 Sets tension=0.5 if initialized with tension=0

Description of the problem

If I generate a CatmullRomCurve3 with tension=0, the curve will actually initialize with a tension=0.5

        const curve = new THREE.CatmullRomCurve3(
          points,  // Tension
          true,  // Closed
          "catmullrom",  // Type
          0  // Tension
        )

Bug: Tension = 0.0 looks like Tension = 0.5

image

Expected: Tension = 0.0

image

I’m achieving this look for the screenshot by setting tension=0.001

I believe this is caused by this code in the initializer:

this.tension = tension || 0.5;

Which should be something like:

const defaultTension = 0.5;
// Handle `0` as a valid input
this.tension = (tension === 0 || tension) ? tension : defaultTension;
Three.js version
  • 0.109.0
Browser
  • All of them
OS
  • All of them

1 possible answer(s) on “CatmullRom3 Sets tension=0.5 if initialized with tension=0

  1. Nice find. We use this pattern to fix that:

    this.tension = ( tension !== undefined ) ? tension : 0.5;

    Would you like to file a PR and fix it?