How to scale an input number range ?

In summary, the problem is that the designer wants the proportions of the gray values to be maintained when the x values change.
  • #1
NikNok
2
0
Hello all,

I'm a 3D graphist trying to deal with particles motions and attributes for visual FX

I have a surface mapped with a black and white picture. Those different grey values gives me a x value inbetween 0(min) and 255(max). Particles are shot from this plane and from random positions and get this point value x based on where they have spawn on the surface, so based on the value of the gray pixel they spawn onto.

I want to play on the speed, size, and more attributes of those particles based on this grey value x.

I need to define a custom minimum and a custom maximum value. So basically, I need to go from :

0 <= x <= 255

to y(min) <= x <= z(max) which can be else -50 <= x <= 50 or else 33.25 <= x <= 68.1

The thing is I want to keep the proportionality in my values
So it is not a clamping function, like

if x > z then x = z
if x < y then z = y

It would be more of a scaling function. Is it ??
Sounds to me like changing the limits of my range (function ?)

It is actually the level function of photoshop,whitout the gray marker
I can right down a script to apply to my particles behavior.

Am I clear enough ? Can you help me ?
 
Last edited:
Physics news on Phys.org
  • #2
NikNok said:
Hello all,
I need to define a custom minimum and a custom maximum value. So basically, I need to go from :

0 <= x <= 255

to y(min) <= x <= z(max) which can be else -50 <= x <= 50 or else 33.25 <= x <= 68.1

Not sure if I totally understand the problem. But can you just do an addition and a multiplication on each x value?

If the range of the original x's was:
0 <= x <= 255
And you make x* = (x-128) * 0.5
then
-64 <= x* <= 63.5
 
  • #3
Figured it out, what I was looking for was actually :

NC = C/(M-m)*(NM-Nm)+Nm


NC = new color
C= color imput
M=maximum
m=minimum
NM=new max
Nm=new min

Thanks for paying attention to this, cheers
 

1. How do I determine the appropriate input number range for my experiment?

The appropriate input number range for an experiment is typically determined by the specific variables and parameters being studied. It is important to consider the expected range of values for each variable, as well as any limitations of the equipment or data collection methods being used.

2. What is the best way to scale an input number range?

The best way to scale an input number range depends on the specific needs and goals of the experiment. Some common methods include logarithmic scaling, linear scaling, and standardization. It is important to carefully consider the potential impact of each method on the data being collected.

3. Can I use the same input number range for all of my experiments?

No, the appropriate input number range will vary depending on the specific variables and parameters being studied in each experiment. It is important to carefully consider the range of values for each variable and adjust the input number range accordingly.

4. How do I avoid bias when scaling an input number range?

To avoid bias when scaling an input number range, it is important to carefully consider the expected range of values for each variable and avoid artificially limiting or expanding the range. It may also be helpful to consult with other scientists or experts in the field for their input and feedback.

5. Are there any tools or software available to help with scaling an input number range?

Yes, there are various tools and software available that can assist with scaling an input number range. These may include statistical software, data visualization tools, or programming languages such as R or Python. It is important to carefully evaluate the capabilities and limitations of these tools before selecting one for your experiment.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
11
Views
488
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
1K
  • Precalculus Mathematics Homework Help
Replies
7
Views
753
Replies
27
Views
1K
  • Introductory Physics Homework Help
Replies
21
Views
2K
  • Precalculus Mathematics Homework Help
Replies
10
Views
1K
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
937
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top