How to use Lerp, LerpFunctor and others?


When browsing the class list, I came upon the Lerp and LerpFunctor classes (and the derived classes). I guess they can be used to interpolate intervals and if so, they can be useful when manipulating texture images.

However, the documentation didn’t gave me any clue on how to use them. Can somebody enlighten me? And are there any examples to study?


Lerp and LerpFunctor are part of an old, deprecated system for lerps, which has since been completely replaced by the interval system. So I don’t recommend trying to learn how to use these old classes.

But I’m not sure what you’re asking about doing. Do you know about the LerpFunc interval, which can be used to generate an interval that defines an arbitrary interpolation (using your own function definition)?


What I’m trying to do is to use Perlin noise to create textures.

Panda3D has the PerlinNoise classes to generate the noise. Now the only thing needed here to generate a decent noise image is to interpolate the values generated. And depending on the type of interpolation you can get better results.

No need to build whats already there, so that’s how I ended up searching for Lerp and LerpFunctor.

What I actually need is the math routines that perform an interpolation based on a number of values. And I guess they’re there (somewhere). There is no need for me to integrate with the rest of the framework. I want to create the image, save it and exit.

Can I use the LerpFunc for this? To me it seemed rather time-based.

It also looks like I have to implement the interpolation myself if I use LerpFunc (which can be tricky for anything less than simple linear interpolation)?

Is using Lerp and LerpFunctor (and derived classes), given the case above, not easier? And if yes, then how to use them (my first question)? If not, is there a way to get to the interpolation code using Python?

Hope anyone can help?
Thx. so far.

To my knowledge, there are no functions that implement anything other than simple linear interpolation provided by Panda. (Sorry!)


OK. At least that answers my questions. Guess I’ll have to reinvent the wheel. Anyway thanks for answering the questions.