Skip to content

CatmullRom3 Sets tension=0.5 if initialized with tension=0 #19757

Closed
@dskeithbuck

Description

@dskeithbuck
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions