How to scale an input number range ?

NikNok
Messages
2
Reaction score
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
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
 
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
 
##\textbf{Exercise 10}:## I came across the following solution online: Questions: 1. When the author states in "that ring (not sure if he is referring to ##R## or ##R/\mathfrak{p}##, but I am guessing the later) ##x_n x_{n+1}=0## for all odd $n$ and ##x_{n+1}## is invertible, so that ##x_n=0##" 2. How does ##x_nx_{n+1}=0## implies that ##x_{n+1}## is invertible and ##x_n=0##. I mean if the quotient ring ##R/\mathfrak{p}## is an integral domain, and ##x_{n+1}## is invertible then...
The following are taken from the two sources, 1) from this online page and the book An Introduction to Module Theory by: Ibrahim Assem, Flavio U. Coelho. In the Abelian Categories chapter in the module theory text on page 157, right after presenting IV.2.21 Definition, the authors states "Image and coimage may or may not exist, but if they do, then they are unique up to isomorphism (because so are kernels and cokernels). Also in the reference url page above, the authors present two...
When decomposing a representation ##\rho## of a finite group ##G## into irreducible representations, we can find the number of times the representation contains a particular irrep ##\rho_0## through the character inner product $$ \langle \chi, \chi_0\rangle = \frac{1}{|G|} \sum_{g\in G} \chi(g) \chi_0(g)^*$$ where ##\chi## and ##\chi_0## are the characters of ##\rho## and ##\rho_0##, respectively. Since all group elements in the same conjugacy class have the same characters, this may be...
Back
Top