Pre loader

How to map 2D X,Y values onto a 3D surface mesh?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

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?

Thanks.
Gareth.

Version
4.2.2.9777
  • You must to post comments
0
0

HI Gareth,

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.

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies