NMorgan wrote at 2011-08-22 16:45:
I was wondering how I could get the cordinate bounds that are being displayed in a viewport? For instance the top left corner is (-100,100) and the bottom left corner is (100,-100).
objo wrote at 2011-08-22 20:37:
hi NMorgan, I don't quite understand what coordinates you need. Do you need the actual client rectangle of the HelixView control? Did you try
new Rect(VisualOffset.X, VisualOffset.Y, ActualWidth, ActualHeight);
(Temporarily arranging a control to VisualOffset=(0,0) helped me out in another project when I was rendering to a RenderTargetBitmap..)
If you need to project 3D coordinates on the 2D view, see the Helpers/ViewPort3DHelper class.
NMorgan wrote at 2011-08-23 14:49:
Hello, thanks for the reponse what I am looking for a rectangle (or just the coordinates of the points) that represents the area being displayed by the viewport.
objo wrote at 2011-08-23 15:48:
Still do not understand. The HelixView control displays a 3D frustum (when using a ProjectionCamera).
NMorgan wrote at 2011-08-23 15:50:
I am using a orthographic camera not a projection. Basicly if I wanted to draw a point at the upper right hand corner of the viewpoint how would I go about getting the coordinates of that point.
objo wrote at 2011-08-23 20:24:
HelixToolkit.Viewport3DHelper.Point2DtoRay3D(yourViewport, new Point(yourViewport.ActualWidth,0))
I have not tested it, but I think this will work with an orthographic camera. Note that this will give you a ray, you can use the Point2DtoPoint3D method if you want a point at the near or far clip plane.
Petzold's 3D programming book could also be a good source for more solutions to this!
Customer support service by UserEcho