SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
I have created a 3D surface mesh successfully and now I want to plot a data series on the mesh. The inputs to the data series are 2D (X,Y) with the Z axis value always being directly on the mapped 3D surface point at the specified X,Y position.
I am trying to populate a XyzDataSeries3D() collection like so…
var xyzData = new XyzDataSeries3D();
xyzData.Append(x, y, z);
How to I determine the Z value given I have the X and Y values? Is there a built-in method for determining this or do I need to do it myself?
Interesting requirement you have there!
OK this is possible using some built in APIs in SciChart.
Firstly, the axis orientation is that Y is up. This is in accordance with the Left Handed Coordinate system in DirectX. where XYZ are arranged as follows:
y ^ z | / |/ -------> x
So the Surface Mesh with all values zero would be a flat plane on the X-Z plane. Once you add values to the Surface Mesh you will see heights in the Y-direction according to the YAxis scaling and VisibleRange.
In order to convert a Y Data-value to a height in World Coordinates, you can use this API:
SciChart3DSurface s; double yData; double yWorldCoord = s.YAxis.GetCoordinate(yData);
Similarly you can convert back with AxisBase3D.GetDataValue()
The X,Z values on the surface mesh are defined by the Start and Step properties of UniformGridDataSeries3D. For example, if StartX is 10 and StepX is 100 then the cell at X=0 will have X-datavalue of 10 and X=1 will have X-datavalue of 110. Conversion between Data-Value and World Coordinate is performed by the axis in SciChart, so some code like this will do the trick.
SciChart3DSurface s; double xData, yData, zData; double xWorldCoord = s.XAxis.GetCoordinate(zData); double yWorldCoord = s.YAxis.GetCoordinate(yData); double zWorldCoord = s.ZAxis.GetCoordinate(zData);
Does that help?
Also if you place two objects at exactly the same location there may be some Z-Fighting between the two. To solve this, you can set the Opacity of the 3D Line series to 0.99. This will force it to be rendered on-top always.
Let me know if this helps.
Please login first to submit.