[Papervision3D] does pv3d have a vector length function
Seb Lee-Delisle
sebstar55 at gmail.com
Fri Oct 17 01:21:29 PDT 2008
Hi Shannon,
I actually added the moduloSquared function, it's weird actually
because I'd never heard of the length of a vector being described as
modulo before, but I was just keeping consistent with the rest of
PV3D. I always called it magnitude before.
And just to be clear, if you want the actual length of a Number3D, use
the modulo property. moduloSquared will return the modulo to the power
of 2. You may ask what's the point of this? If you're just comparing
the lenght of a Number3D with some other value you'd use :
if (mynumber3D.modulo<myvalue)
{
// do something
}
except in the modulo getter function there's a CPU expensive square
root calculation, which is slow (although massively faster in recent
versions of the flashplayer).
Instead, use
if(mynumber3D.isModuloLessThan(myvalue))
{
// do something
}
Which is the same as :
if(mynumber3D.moduloSquared< myvalue*myvalue)
{
}
which does the comparison of the modulo squared with the value
squared. I'm not explaining things very well this morning (still
drinking my coffee) but suffice it to say, it's faster to use
Number3D.isModuloGreaterThan / isModuloLessThan methods.
Seb
On Fri, Oct 17, 2008 at 12:27 AM, dsdsdsdsd <shannonhburnett at hotmail.com> wrote:
>
> thanks;
>
> do you know why they are using the term 'modulo' in their naming; I have
> always understood modulus as being the remainder of a fraction;
>
>
> thanks,
> Shannon
> --
> View this message in context: http://www.nabble.com/does-pv3d-have-a-vector-length-function-tp20015936p20019792.html
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
More information about the Papervision3D
mailing list