Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I have float noise values, between -1 and 1, for every x,y coordinate in a 2D area and I am trying to convert that to a whole number between 0 and 319 which represents a vertical z coordinate to re...
#6: Post edited
I have float noise values, between -1 and 1, for every x,y coordinate in a 3D area and I am trying to convert that to a whole number between 0 and 319 which represents a vertical z coordinate to render.- For example,
- ```
- -1 = 0 and
- 1 = 319 but
- 0.12345 = ???
- ```
- How would I go about implementing this efficiently?
- I have float noise values, between -1 and 1, for every x,y coordinate in a 2D area and I am trying to convert that to a whole number between 0 and 319 which represents a vertical z coordinate to render.
- For example,
- ```
- -1 = 0 and
- 1 = 319 but
- 0.12345 = ???
- ```
- How would I go about implementing this efficiently?
#5: Post edited
How to proportionally convert a number in the range of -1 and 1 to a number between 0 and 319
- How to proportionally convert a number in the range of -1 and 1 to a number in the range of 0 and 319
#4: Post edited
- I have float noise values, between -1 and 1, for every x,y coordinate in a 3D area and I am trying to convert that to a whole number between 0 and 319 which represents a vertical z coordinate to render.
- For example,
- ```
- -1 = 0 and
- 1 = 319 but
- 0.12345 = ???
- ```
How would I implement this efficiently?
- I have float noise values, between -1 and 1, for every x,y coordinate in a 3D area and I am trying to convert that to a whole number between 0 and 319 which represents a vertical z coordinate to render.
- For example,
- ```
- -1 = 0 and
- 1 = 319 but
- 0.12345 = ???
- ```
- How would I go about implementing this efficiently?
#3: Post edited
How to proportionally convert a number in the range of -1 and 1 to a number between 0 and 255
- How to proportionally convert a number in the range of -1 and 1 to a number between 0 and 319
#2: Post edited
I have float noise values, between -1 and 1, for every x,y coordinate in a 3D area and I am trying to convert that to a whole number between 0 and 255 which represents a vertical z coordinate to render.- For example,
- ```
- -1 = 0 and
1 = 255 but- 0.12345 = ???
- ```
- How would I implement this efficiently?
- I have float noise values, between -1 and 1, for every x,y coordinate in a 3D area and I am trying to convert that to a whole number between 0 and 319 which represents a vertical z coordinate to render.
- For example,
- ```
- -1 = 0 and
- 1 = 319 but
- 0.12345 = ???
- ```
- How would I implement this efficiently?
#1: Initial revision
How to proportionally convert a number in the range of -1 and 1 to a number between 0 and 255
I have float noise values, between -1 and 1, for every x,y coordinate in a 3D area and I am trying to convert that to a whole number between 0 and 255 which represents a vertical z coordinate to render. For example, ``` -1 = 0 and 1 = 255 but 0.12345 = ??? ``` How would I implement this efficiently?