Parametric Function for Coloring I'm trying to write a parametric straightline function that change

Andy Erickson

Andy Erickson

Answered question

2022-05-21

Parametric Function for Coloring
I'm trying to write a parametric straightline function that changes its values between 0.529 and 0.933.
Usually what I would do is:
r = 0.529 + ( 0.933 0.529 ) v where parameter v = [ 0 , 1 ]
This ensure that my r value will either be 0.529 or 0.933
However, due to some limitations my parameter v has to be changed to v = [ 2 , 1 ]
Is there anyway that I can change the straightline function such that it will still return r as either 0.529 or 0.933?

Answer & Explanation

hoffwnbu

hoffwnbu

Beginner2022-05-22Added 13 answers

Step 1
Ok you want a transformation for [-2,1] to [0,1] then change v for ( v + 2 ) 1 3
The reasoning is the next, you want the -2 will be maped to 0 and the 1 to 1, the easiest way is a line with slope:
1 0 1 ( 2 ) = 1 3
Step 2
Then the line equation will be:
v = 0 + 1 3 ( v ( 2 ) )
v = 1 3 ( v + 2 )
Jerry Villegas

Jerry Villegas

Beginner2022-05-23Added 4 answers

Step 1
Change v for ( v + 2 ) / 3.
Step 2
This maps -2 to 0 and 1 to 1.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?