Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
dskeithbuck opened this issue Jun 29, 2020 · 1 comment
Closed
2 tasks done

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

dskeithbuck opened this issue Jun 29, 2020 · 1 comment
Labels

Comments

@dskeithbuck
Copy link
Contributor

dskeithbuck commented Jun 29, 2020

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
@WestLangley
Copy link
Collaborator

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?

@Mugen87 Mugen87 added the Bug label Jun 30, 2020
dskeithbuck added a commit to dskeithbuck/three.js that referenced this issue Jun 30, 2020
@mrdoob mrdoob closed this as completed Jun 30, 2020
beginor pushed a commit to beginor/three.js that referenced this issue Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants