jmac698
26th October 2011, 10:53
Hi,
I need an accurate arccos function in avisynth script. I tried the one from.. can't remember it's name, but it's not accurate enough and is limiting my application.
I'm not setup for plugin development either; I hate to get sidetracked for an hour just to write a plugin for one function - argh. If anyone is setup for development, would you consider writing a arcsin, arccos, and atan2 functions? It should be 5 minutes for you :) I really need it to finish researchiing my software TBC.
Anyhow, here's the inaccurate function:
Function __arc_sin(float x, float "__prev", int "__step", float "__pterm")
{
__prev = Default(__prev, x)
__pterm = Default(__pterm, x)
__step = Default(__step, 1) # step 0 is introduced by defaults
st2 = 2 * __step
t = st2 - 1
term = __pterm * (Float(t * t) / Float(st2 * (st2 + 1))) * (x * x)
return Abs(term) > 0.00001 \
? __arc_sin(x, __prev + term, __step + 1, term) \
: __prev + term
}
Function ArcSin(float x) { return __arc_sin(x) }
Function ArcCos(float x) { return (Pi/2) - ArcSin(x) }
Thanks.
I need an accurate arccos function in avisynth script. I tried the one from.. can't remember it's name, but it's not accurate enough and is limiting my application.
I'm not setup for plugin development either; I hate to get sidetracked for an hour just to write a plugin for one function - argh. If anyone is setup for development, would you consider writing a arcsin, arccos, and atan2 functions? It should be 5 minutes for you :) I really need it to finish researchiing my software TBC.
Anyhow, here's the inaccurate function:
Function __arc_sin(float x, float "__prev", int "__step", float "__pterm")
{
__prev = Default(__prev, x)
__pterm = Default(__pterm, x)
__step = Default(__step, 1) # step 0 is introduced by defaults
st2 = 2 * __step
t = st2 - 1
term = __pterm * (Float(t * t) / Float(st2 * (st2 + 1))) * (x * x)
return Abs(term) > 0.00001 \
? __arc_sin(x, __prev + term, __step + 1, term) \
: __prev + term
}
Function ArcSin(float x) { return __arc_sin(x) }
Function ArcCos(float x) { return (Pi/2) - ArcSin(x) }
Thanks.