I have topographic data that is gridded with an image overlay. I need to export this to a file (GLB, PLY, etc). that retains height and color/texture.
image.jpg (72.6 KB)
The data structure is:
int nPtsAlongX = 1024; // width in pixels
int nPtsAlongY = 768; // height in pixels
double dSpacingAlongXMM = 1.5;
double dSpacingAlongYMM = 2.5;
double dXOriginMM = 10.0;
double dYOriginMM = 5.0;
// INVALID POINTS are float.MinValue
float fSurfaceHeightsMM = new float[nPtsAlongY, nPtsAlongX];
Bitmap bmpOverlay = new Bitmap(nPtsAlongX, nPtsAlongY);
Individual points and colors can be extracted via:
for (int nY=0; nY<nPtsAlongY; nY++)
{
for (int nX=0; nX<nPtsAlongX; nX++)
{
if (fSurfaceHeightsMM[nY, nX] != float.MinValue)
{
double dXCurrentMM = dXOriginMM + dSpacingAlongXMMnX;
double dYCurrentMM = dYOriginMM + dSpacingAlongYMMnY;
double dZCurrentMM = fSurfaceHeightsMM[nY, nX];
Color colorCurrent = bmpOverlay.GetPixel(nX, nPtsAlongY-1-nY);
// do something with X, Y, Z and color… like put them in a list for saving to a file!
} // end if valid
} // end for nX
} // end for nY
What is the most efficient way to convert these points to a scene and export to a 3D file?
Thanks!