question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

creating Vectors with NaN values replaces most of them with 0

See original GitHub issue

Setting any THREE.Vectorx with NaN values causes the NaN value to be replaced by 0, except for the w field of a Vector4. eg new Vector3(NaN, 3, 4) returns Vector3(0, 3, 4) new Vector4(NaN, NaN, NaN, NaN) returns Vector4(0, 0, 0, NaN)

I can see fixing this would add a fraction to the common code path, but it causes some very unexpected failure to propagate NaN values.

Three.js version
  • Dev
  • [x ] r117
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
WestLangleycommented, Jun 13, 2020

three.js does not support NaNs. I do not think three.js should be responsible for converting them to zeros or ones.

NaNs should be handled at the app level, IMO – and not passed into constructors.

1reaction
mrdoobcommented, Jun 16, 2020

I was passing a number. typeof NaN is 'number'.

This made my blood boil for so many reasons…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Replacing unassigned values in a vector with nans instead of ...
Replacing unassigned values in a vector with nans instead of zeros ... around them - then unassigned values in the vector automatically equal...
Read more >
R Replace NA with 0 (10 Examples for Data Frame, Vector ...
A common way to treat missing values in R is to replace NA with 0. You will find a summary of the ......
Read more >
Replace NaN Values with Zeros in Pandas DataFrame
NaN stands for Not A Number and is one of the common ways to represent the missing value in the data. It is...
Read more >
Replace NaN values in a list with zero (0) - Stack Overflow
I forced z to data frame but it wasn't enough, maybe there is a form to change NaN in list. Thanks for your...
Read more >
How to Replace NaN Values with Zero in NumPy - Statology
The following code shows how to replace all NaN values with zero in a NumPy array: import numpy as np #create array of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found