Carlos, it's a wrapper routine I use to go between 3.5 and 3.6.  It converts
a Vector3D to a Number3D in 3.5 and it just passes through the Vector3D in
3.6.  If you are running 3.6, you don't need it.

Best,

BW




On Fri, Apr 8, 2011 at 11:41 AM, carlos.lunetta <carlos.lune...@gmail.com>wrote:

> One question - what is the N2V in the code?
>
> Thanks!
>
> On Apr 8, 3:09 pm, Bob Warfield <b...@thewarfields.com> wrote:
> > Carlos, to go from 2D to 3D I have been using Fabrice's Drag3D in a
> routine
> > like this:
> >
> > *public* *function* mouseTo3D(screenX:Number, screenY:Number,
> screenZ:Number
> > = 0):Vector3D
> >
> > {
> >
> > *var* n3D:Vector3D = *new* Vector3D;
> >
> > *// var persp:Number = view.camera.zoom / view.camera.focus;
> > *
> >
> > *// Use Fabrice's Drag3D class...
> > *
> >
> > *var* d3D:Drag3D = *new* Drag3D( view );
> >
> > *var* plane:String = gridStyle.toLowerCase();
> >
> > plane = (plane == *"yz"*) ? *"zy"* : plane;
> >
> > d3D.plane = plane;
> >
> > n3D = N2V(d3D.getIntersect( screenX, screenY ));
> >
> > *// 8? WTF?
> > *
> >
> > *if* (view.camera.lens *is* OrthogonalLens) {
> >
> > n3D.x /= 8;
> >
> > n3D.y /= 8;
> >
> > n3D.z /= 8;
> >
> > }
> >
> > *return* n3D;
> >
> > }
> >
> > Ignore the occassional dark mutterings in that code.
> >
> > For 3D to 2D, I use the camera's screen method something like this:
> >
> > sv = view.camera.screen( *this*, *this*.mesh.vertices[i] );
> >
> > Pass it in a vertex or other point, get back a ScreenVertex.
> >
> > Cheers,
> >
> > BW
> >
> > On Fri, Apr 8, 2011 at 10:38 AM, carlos.lunetta <
> carlos.lune...@gmail.com>wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hello all
> >
> > > I've read a couple of opinions regarding the conversion of a 2D
> > > coordinate to 3D space, but not sure the best way to proceed. Some
> > > people talk about deperspective, but it's not present on 3.6 anymore.
> >
> > > I have the screenX and screenY coordinates, and the desired Z depth -
> > > looking for the projected x and y. What would be the best way to go?
> >
> > > thanks a lot!

Reply via email to