Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

OrthographicCamera.Width and translation 2D to 3D

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-31-2006   #1 (permalink)
Erno
Guest


 

OrthographicCamera.Width and translation 2D to 3D

Hi!

Am I right that the Width property of the OrthographicCamera contains only
half of the value that is in the MSDN documentation? My docs say that it
specifies the Width of the camera box but when I test by displaying a grid
it shows me twice as much...

BTW is there an easy way of translating a pixel offset inside the ViewPort3D
to a 'point' in Camera space? Of course, when I have a matixcamera I would
be able to apply the inverse matrix... or something like that...

At the moment I do the mapping myself...

Thanks,

Erno



My System SpecsSystem Spec
Old 01-31-2006   #2 (permalink)
Bob Brown[MSFT]
Guest


 

Re: OrthographicCamera.Width and translation 2D to 3D

The MSDN docs are correct. The following orthographic camera will view the
volume from TLF: [-1,-1,-1] to BRB [1,1,-20]: (TLF = top-left-front, BRB =
bottom-right-back)

camera = new OrthographicCamera();
camera.Position = new Point3D( 0,0,0 );
camera.LookDirection = new Vector3D( 0,0,-1 );
camera.UpDirection = new Vector3D( 0,1,0 );
camera.NearPlaneDistance = 1;
camera.FarPlaneDistance = 20;
camera.Width = 2;

Can you tell me a little more about your scene/camera? I'm pretty sure that
the Width property is doing the right thing.


For #2, there is no API that transforms a 2D point to the 3D world. Such a
transform cannot exist (since you won't know where in Z to put the thing).
You can transform the 2D point into a ray in the 3D world though, but there
is no public API for this either. When you do hit testing from 2D -> 3D
(i.e. what 3D model is my mouse hovering over?), this is essentially what we
are doing. The RayHitTestResults will give you points in 3D space where the
ray intersects with models. Are you trying to do your own hit testing?

--
Bob Brown [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.


"Erno" <nospam> wrote in message
news:Ol9ELrMJGHA.3816@TK2MSFTNGP12.phx.gbl...
> Hi!
>
> Am I right that the Width property of the OrthographicCamera contains only
> half of the value that is in the MSDN documentation? My docs say that it
> specifies the Width of the camera box but when I test by displaying a grid
> it shows me twice as much...
>
> BTW is there an easy way of translating a pixel offset inside the
> ViewPort3D to a 'point' in Camera space? Of course, when I have a
> matixcamera I would be able to apply the inverse matrix... or something
> like that...
>
> At the moment I do the mapping myself...
>
> Thanks,
>
> Erno
>



My System SpecsSystem Spec
Old 01-31-2006   #3 (permalink)
Erno
Guest


 

Re: OrthographicCamera.Width and translation 2D to 3D

Hi Bob!

Thanks for answering!

On #1 I will post in a little becuse I will try to remove all interference
from my app. That quite some work (take a look:
http://blogs.infosupport.com/ernow/articles/3603.aspx
(screenshot linked at the bottom)

On #2: Yes, I am doing my own hit testing BUT on nothing... I want the user
to be able to click and draw where there is no geometry yet (after all it is
a drawing tool :-) ) or in case of selecting: I want to give the user some
slack...

So I basically calculate the click on the DockPanel that is behind the
viewport to a point in 3D space and conjure up a z-value. This calculation
isn't hard.

Erno


"Bob Brown[MSFT]" <robbrow@online.microsoft.com> wrote in message
news:%23TO2wqeJGHA.424@TK2MSFTNGP12.phx.gbl...
> The MSDN docs are correct. The following orthographic camera will view
> the volume from TLF: [-1,-1,-1] to BRB [1,1,-20]: (TLF = top-left-front,
> BRB = bottom-right-back)
>
> camera = new OrthographicCamera();
> camera.Position = new Point3D( 0,0,0 );
> camera.LookDirection = new Vector3D( 0,0,-1 );
> camera.UpDirection = new Vector3D( 0,1,0 );
> camera.NearPlaneDistance = 1;
> camera.FarPlaneDistance = 20;
> camera.Width = 2;
>
> Can you tell me a little more about your scene/camera? I'm pretty sure
> that the Width property is doing the right thing.
>
>
> For #2, there is no API that transforms a 2D point to the 3D world. Such
> a transform cannot exist (since you won't know where in Z to put the
> thing). You can transform the 2D point into a ray in the 3D world though,
> but there is no public API for this either. When you do hit testing from
> 2D -> 3D (i.e. what 3D model is my mouse hovering over?), this is
> essentially what we are doing. The RayHitTestResults will give you points
> in 3D space where the ray intersects with models. Are you trying to do
> your own hit testing?
>
> --
> Bob Brown [MSFT]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "Erno" <nospam> wrote in message
> news:Ol9ELrMJGHA.3816@TK2MSFTNGP12.phx.gbl...
>> Hi!
>>
>> Am I right that the Width property of the OrthographicCamera contains
>> only half of the value that is in the MSDN documentation? My docs say
>> that it specifies the Width of the camera box but when I test by
>> displaying a grid it shows me twice as much...
>>
>> BTW is there an easy way of translating a pixel offset inside the
>> ViewPort3D to a 'point' in Camera space? Of course, when I have a
>> matixcamera I would be able to apply the inverse matrix... or something
>> like that...
>>
>> At the moment I do the mapping myself...
>>
>> Thanks,
>>
>> Erno
>>

>
>



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
translation needed: C to VB EricW .NET General 2 08-15-2008 08:52 AM
Language Translation jim7567g Vista General 1 03-05-2008 08:51 AM
chat translation INQUISITIVE Live Messenger 1 01-14-2008 09:14 PM
Hostname to IP translation Joe Freedom PowerShell 14 12-12-2007 09:47 AM
web page translation... Gordon J. Rattray Vista General 3 09-25-2007 05:49 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51