[Papervision3D] Distance between two 3D points

John Grden neoriley at gmail.com
Fri Aug 24 15:07:03 PDT 2007


sorry, heres the entire method:

public function distanceTo( obj:DisplayObject3D ):Number
    {
        var x :Number = this.x - obj.x;
        var y :Number = this.y - obj.y;
        var z :Number = this.z - obj.z;

        return Math.sqrt( x*x + y*y + z*z );
    }

I'm assuming you could use the same logic

On 8/24/07, John Grden <neoriley at gmail.com> wrote:
>
> DisplayObject3D.distanceTo()
>
> /**
>     * Gets the distance to the position of the given object.
>     *
>     * @param    obj        The display object to measure the distance to.
>     * @return    The distance to the registration point of the given
> object.
>     */
>     public function distanceTo( obj:DisplayObject3D ):Number
>
> On 8/24/07, Patrick Matte | BLITZ < PMatte at blitzagency.com> wrote:
>
> >  Is there a method somewhere that returns the distance between two
> > points ? I was looking at Number3D's methods but didn't find anything like
> > that.
> >
> >
> >
> > *BLITZ | Patrick Matte* 310-551-0200 *x214*
> >
> > *From:* papervision3d-bounces at osflash.org [mailto:
> > papervision3d-bounces at osflash.org] *On Behalf Of *John Grden
> > *Sent:* Friday, August 24, 2007 12:46 PM
> > *To:* Papervision3D at osflash.org
> > *Subject:* [Papervision3D] Very interesting speed comparison
> >
> >
> >
> > Morf just updated the OSflash page on speed optimization and one thing
> > that surprised me is:
> >
> > This:
> >
> > if (n < 0)  n = -n;
> >
> > is faster than:
> >
> > var test:Number = n < 0 ? 0-n : n;
> >
> > --
> > [  JPG  ]
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> >
>
>
> --
> [  JPG  ]




-- 
[  JPG  ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070824/b2d56ddf/attachment.html 


More information about the Papervision3D mailing list