WPF 3D - Need help writing conversion methods between 2D and 3D (Point3DToPoint and PointAndZToPoint

Filed under:
|
|
|
c#

I'm new to WPF 3D, so I may just be missing something obvious, but how do I convert from 3D to 2D and (for a given z location) from 2D to 3D?

Specifically, I need two conversion methods:

• Point3DToPoint - If I have an (x, y, z) coordinate in the 3D world, how do I determine the (x, y) coordinate on the projected 2D surface. Method signature: `public Point Point3DToPoint(Point3D point3D)`

• PointAndZToPoint3D - If I have an (x, y) coordinate on the projected 2D surface and a z location in the 3D world, how do I determine the intersecting (x, y, z) coordinate in the 3D world? Method signature: `public Point3D PointAndZToPoint3D(Point point, double z)`

I'd like the 2D coordinate to be the location measured from the upper-left corner of `Viewport3D` and the 3D coordinate to be the location relative to the origin (0, 0, 0) of the 3D world.

Note 1: I found this related question, but it only addresses conversion from 3D to 2D (not the reverse), and I'm not sure if the answers are up-to-date.

Note 2: I'm currently using .NET 3.5, but if there are improvements in .NET 4.0 that would help me, please let me know.

© Stack Overflow or respective owner

• WPF 3D - converting from Point2D to Point3D and back again

as seen on Stack Overflow - Search for 'Stack Overflow'
I'm new to WPF 3D, so I may just be missing something obvious, but how would I go about converting from a 2D coordinate to a 3D coordinate and back again? I'd like the 2D coordinate to be the location measured from the upper-left corner of Viewport3D and the 3D coordinate to be the location relative… >>> More

• WPF 3D - Need help writing conversion methods between 2D and 3D (Point3DToPoint and PointAndZToPoint

as seen on Stack Overflow - Search for 'Stack Overflow'
I'm new to WPF 3D, so I may just be missing something obvious, but how do I convert from 3D to 2D and (for a given z location) from 2D to 3D? Specifically, I need two conversion methods: Point3DToPoint - If I have an (x, y, z) coordinate in the 3D world, how do I determine the (x, y) coordinate… >>> More

• How to make non-blurry image in WPF 3d

as seen on Stack Overflow - Search for 'Stack Overflow'
I used Viewport3D and ModelVisual3D to create a simple rectangle with an image (I tried it with JPG, PNG), but it shows the image blurry, but the original image is very sharp and clear. I don't know how to make it with the original quality in 3D... I also tried some 2D solutions like RenderOptions… >>> More

• Rotating a full 360 degrees in WPF 3D

as seen on Stack Overflow - Search for 'Stack Overflow'
Hi, I have a ModelVisual3D of a cube and I want to animate it to rotate around its axis for 360 degrees. I make a RoationTransform3D which I tell to rotate 360 but it doesn't rotate at all, also if you say 270 degrees it rotates only 90 degrees but in the opposite direction. I guess he computer calculates… >>> More

• Saving new indicies, triangles and normals after WPF 3D transform

as seen on Stack Overflow - Search for 'Stack Overflow'
Hi, I have a 3D model which is lying flat currently, I wish for it to be rotated 90 degrees around the X axis. I have no problem doing this with the transforms. But to my knowledge all the transforms are a bunch of matrices multiplied. I would like to have the transform really alter all the coordinates… >>> More

• C#/WPF - RoutedEvent in WPF class that isn't a UIElement

as seen on Stack Overflow - Search for 'Stack Overflow'
I have a class that needs to notify that something significant has occured. The class is in a WPF-project, even though this specific class, is lookless (and doesn't inherit from UIElement, neither directly or indirectly). Normally, I just register a RoutedEvent to get this functionality but as this… >>> More

• How to pass value from wpf form to wpf user control

as seen on Stack Overflow - Search for 'Stack Overflow'
Hai am having a WPF user control in my WPF Form, when i click my button in my form , i just want to pass some value to the textbox which is in the usercontrol, tell me how to do this. >>> More

• WPF opening up exe program within WPF window

as seen on Stack Overflow - Search for 'Stack Overflow'
Not sure if this is possible but is there a way to open up another program like notepad within the container of a WPF window? similiar to that of being able to open a web page using the webbrowser control? Basically I would like to open notepad or other exe but keep it constrained within the WPF… >>> More

• Silverlight Commands Hacks: Passing EventArgs as CommandParameter to DelegateCommand triggered by Ev

as seen on ASP.net Weblogs - Search for 'ASP.net Weblogs'
Today I've tried to find a way how to pass EventArgs as CommandParameter to DelegateCommand triggered by EventTrigger. By reverse engineering of default InvokeCommandAction I find that blend team just ignores event args.To resolve this issue I have created my own action for triggering delegate commands… >>> More

• Building applications with WPF, MVVM and Prism(aka CAG)

as seen on ASP.net Weblogs - Search for 'ASP.net Weblogs'
In this article I am going to walk through an application using WPF and Prism (aka composite application guidance, CAG) which simulates engaging a taxi (cab).  The rules are simple, the app would have3 screens A login screen to authenticate the user An information screen. A screen… >>> More