Archive: log(var1,var2)?


4th July 2002 14:25 UTC

log(var1,var2)?
Everyone agrees that pow(var1,var2) is a useful function. But quite often when working with logarythms log(var) and log10(var) is just not enough. In order to get a logarythm of a base other than 10 or e you have to do the following: log base A of var = log(var)/log(A). Can't it just be replaced with a log(var1,var2), where var1 is the base?

log(var) can be replaced with ln(var) and log10(var) can be replaced with lg(var). The only problem with this is that the old presets that contained log and log10 functions won't work. In this case some sort of a conversion tool can be useful (a 'replace old functions button' of some sort in SSC, DM, DS, DDM and others that use manual coding).

P.S. Has anyone wished for an integrated preset compression program like PIMP or NSIS in AVS that would allow to create packs fast an easy (without creating a separate script and using a windows interface. Just select files, output dir, uninstall path, different for various files and press "make pack")? Perhaps it can be a part of a preset browser.

Or am I just dreaming?:hang:


4th July 2002 14:44 UTC

I don't think we should be messing with the existing functions.

It will cause too many complications. For me ne functions should be just that new functions with new names. Backwards compatibility is a very important part of it.

What about a calling the function of Logbase(var1,var2) or something.

Though I must say I don't know how often this function will be used. Too much excessive functions will only work against the speed of AVS.


5th July 2002 00:26 UTC

I don't see what the problem is with doing the division yourself though.
On top of that, if you keep your base fixed, you can calculate log[e](base) or log[10](base) yourself and save its reciprocal (1/x) as a constant. That way, you only need one extra multiplication rather than a logarithm and a division.

I'm curious what you're using logarithms for though.


5th July 2002 11:21 UTC

I've used them to create a capsule-like shapes with a SSC. First create a tube made out of a spiral. Then apply the log function for let's say i>0.75 and the pow function to i<0.25 or the other way round (can't remember right now). That way the ends get rounded off.

x=('code for spiral 3d tube')*(c1+c2+1)
y=('code for spiral 3d tube')*(c1+c2+1)
c1=-log(var1,var2)*above(i,somevalue)
c2=-pow(var1,var2)*below(i,somevalue)

I can't remember the code exactly because I'm not writing this at home and don't have my presets with me. Anyway I even managed to create a microphone shape with an antenna with a SSC. It's gonna come out in a pack (RomaAVS3) soon.

UnConeD, you are right about that multiplication thing though. I just like being lazy sometimes, that's all.:) . Though Logbase(var1,var2)does sound good.


5th July 2002 16:15 UTC

Log vs power
Hmmm sounds like you're using log as a sort of mirror of pow... remember that log is the inverse function. In order to get a mirror, just use the inverse power (.5 instead of 2).

If you want a correct circular/spherical rounding, use a variation on the function sqrt(1-sqr(x)) which is a half-circle for x in [-1;1]


9th July 2002 07:08 UTC

Thanks
I'll have to try that:)


31st July 2002 15:05 UTC

thanx
Thanx 2 ur code i did a woderfull thing in the DM.
I'll show u when I'll finsh it.


31st July 2002 15:40 UTC

wrong thread?


7th August 2002 17:49 UTC

no i did play with the code and its came wonderfull.