![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
| | #3 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |