![]() |
|
XYZ coordinates orientation - Printable Version +- AB4D Forum (https://forum.ab4d.com) +-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4) +--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9) +--- Thread: XYZ coordinates orientation (/showthread.php?tid=3958) |
XYZ coordinates orientation - HFP - 12-29-2015 Dear Andrej and Ab3d users, I'm still new in understanding and using these great 3D functionalities for my C# developing ... That's why I have some fundamental questions of the concept and therefor the best way for an adequate using in my applications. Basically, my use cases are in geographic resp. geodetic relations. This kind of abstraction for real-life conditions has typically the following definition of XYZ coordinates orientation:
It's no problem with other models because I can change their XYZ coordinates orientation quite easy. But how to solve this for HeightMap? Thanks a lot in advance & best regards, Hagen RE: XYZ coordinates orientation - abenedik - 01-08-2016 WPF is using standard right handed coordinate system where X is to the right, Y up and Z "away from the screen". Also the Ab3d.PowerToys camera work well when Y axis is pointing up. The cameras (expect FreeCamera) do not work well in any other coordinate system. Therefore I would advise you to preserve the Y up axis and convert the coordinates of objects before you apply them to WPF 3D objects. For example if one object is at (100, 200, 300) in your coordinates, you need to show it at (100, 300, -200) coordinates in WPF. Another solution is to define a ModelVisual3D with a MatrixTransform3D that transform coordinate system from your coordinate system to WPF coordinate system. It can be defined with the following XAML: Code: <ModelVisual3D x:Name="ZUpRootVisual">Then you can add 3D objects into this ModelVisual3D and use coordinates in your coordinate system. But you cannot use this ModelVisual3D for HeightMapVisual3D because HeightMapVisual3D already uses Y axis as up axis. But this should not be a problem because HeightMapVisual3D already have the planar X and Y coordinates in the HeightData array and Height value that is pointing up. If you are using CameraAxisPanel to show coordinate axes, you can change the axes direction there - see CameraPanelsSample.xaml. For the next version of Ab3d.PowerToys (v7.4) I have prepared a simple on how to do that (without HeightMap). You can try it with downloading the following two files:
CustomUpAxisSample.xaml (Size: 4.6 KB / Downloads: 6)
CustomUpAxisSample.xaml.cs (Size: 1.26 KB / Downloads: 4)
Add them to the samples solution to the Cameras folder. Then open the Samples.xml on the root folder and add the following under Cameras: <Sample Page="Cameras/CustomUpAxisSample.xaml" Title="Custom Up axis" Description="" /> RE: XYZ coordinates orientation - HFP - 01-08-2016 (01-08-2016, 04:08 PM)abenedik Wrote: ... because HeightMapVisual3D already uses Y axis as up axis. But this should not be a problem because HeightMapVisual3D already have the planar X and Y coordinates in the HeightData array and Height value that is pointing up. Dear Andrej, Thanks a lot for your help! At the end of the day, it seems to be only a small problem now ... :-) Because it's already easy to change the position and direction of my TargetPositionCamera, I can simply start the Viewport3D in the right way (related to geodetic or geographic orientation): https://www.optimalsystem.de/os/pics/OptimalSystem-FeldLog-3D-Log.png And due to its definition, HeightMapVisual3D is just adequate to this real-world XYZ orientation ... :-) And of course I'll also try to realize your new recommendations! Best wishes, Hagen |