Jump to content

  • Log In with Google      Sign In   
  • Create Account


lerp between functions


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 ryt   Members   -  Reputation: 294

Like
0Likes
Like

Posted 22 December 2013 - 05:49 AM

Is it possible to lerp between functions ?

The general formula that can be used for lerp between vectors is (1-t)v + tv1. But what if instead of a vector we put in a function like (1-t)x + v*x^2 where f(x) = x is the first function and g(x) = x^2 is second one. Will this work ?



Sponsor:

#2 Paradigm Shifter   Crossbones+   -  Reputation: 4783

Like
1Likes
Like

Posted 22 December 2013 - 06:01 AM

Yes that would just be pointwise lerp between the functions evaluated at a specific point. A function can often be considered to be a vector anyway (e.g. the vector space C[0,1] is the space of all continuous functions defined in the interval [0,1]).


"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

#3 Álvaro   Crossbones+   -  Reputation: 10625

Like
1Likes
Like

Posted 22 December 2013 - 08:34 AM

If we want to be completely pedantic, LERP is an operation that is defined in affine spaces. So for instance you can linearly interpolate between two positions, even though positions are not vectors. But every vector space can be seen as an affine space as well (some people think of this as "forgetting where the origin is"), so you can use LERP in any vector space, including spaces of functions.

#4 ryt   Members   -  Reputation: 294

Like
0Likes
Like

Posted 23 December 2013 - 12:29 PM

I am not sure if this is right but if we take some other functions that are not linear like quadratic, will this still than hold ?

Will the space than again be affine ?



#5 Álvaro   Crossbones+   -  Reputation: 10625

Like
0Likes
Like

Posted 23 December 2013 - 12:32 PM

Quadratic in t? As long as all you are doing is taking a weighted sum of things with weights that add up to one, you are in good shape with any affine space.



#6 ryt   Members   -  Reputation: 294

Like
0Likes
Like

Posted 23 December 2013 - 12:44 PM

Well I meant in x, but it could be in t also.

Why it needs to add up to one ?


Edited by ryt, 23 December 2013 - 12:45 PM.


#7 Álvaro   Crossbones+   -  Reputation: 10625

Like
0Likes
Like

Posted 23 December 2013 - 12:51 PM

No, no. Nobody is restricting the discussion to only linear functions. The "linear" in "linear interpolation" (what "LERP" stands for) refers to the dependence on t.



#8 ryt   Members   -  Reputation: 294

Like
0Likes
Like

Posted 23 December 2013 - 01:50 PM

I am a little confused. But anyway I can take any function I want for f(x) and g(x) so that (1-t)f(x) + tg(x) ?

What would be the cases where I could not take any function ?



#9 Álvaro   Crossbones+   -  Reputation: 10625

Like
1Likes
Like

Posted 23 December 2013 - 02:09 PM


But anyway I can take any function I want for f(x) and g(x) so that (1-t)f(x) + tg(x) ?

Yes.

 


What would be the cases where I could not take any function ?

I don't understand that question. If you are asking about situations where it is not OK to take linear combinations like that, think of two points on the surface of a doughnut, two 3D rotations or even two points on a circle. There might be ways to make something that behaves similarly to LERP in those cases, but it will be much less straight forward than (1-t)*A+t*B.



#10 ryt   Members   -  Reputation: 294

Like
0Likes
Like

Posted 23 December 2013 - 02:16 PM

 I don't understand that question. If you are asking about situations where it is not OK to take linear combinations like that, think of two points on the surface of a doughnut, two 3D rotations or even two points on a circle. There might be ways to make something that behaves similarly to LERP in those cases, but it will be much less straight forward than (1-t)*A+t*B.

 

 I was asking that to see if there were cases where I could not do this.

 

Thank you, it is much clearer to me now.



#11 Tom KQT   Members   -  Reputation: 1348

Like
1Likes
Like

Posted 06 January 2014 - 03:25 AM

You'll maybe just have to be careful about possible discontinuities in f(x) or g(x). If one of them gives you infinity for a particular x, LERPing the values won't be straightforward.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS