Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - OrthographicCamera.Width and translation 2D to 3D

 
 
Old 01-31-2006   #1 (permalink)
Erno


 
 

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]


 
 

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


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
CBS Log translation? Network & Sharing
Language Translation Vista General
chat translation Live Messenger
web page translation... Vista General
Need Translation into English. Vista General


Vista Forums 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 Ltd

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