My program saves a pointcloud to file, where each pointcloud is a Point3D[,]
, from the System.Windows.Media.Media3D
namespace. This shows a line of the output file (in portuguese):
-112,644088741971;71,796623005014;NaN (N?o é um número)
while I'd like it to be (on order to be correctly parsed afterwards):
-112,644088741971;71,796623005014;NaN
The block of code that generates the file is here:
var lines = new List<string>();
for (int rows = 0; rows < malha.GetLength(0); rows++) {
for (int cols = 0; cols < malha.GetLength(1); cols++) {
double x = coordenadas_x[cols];
double y = coordenadas_y[rows];
double z;
if ( SomeTest() ) {
z = alglib.rbfcalc2(model, x, y);
} else {
z = double.NaN;
}
var p = new Point3D(x, y, z);
lines.Add(p.ToString());
malha[rows, cols] = p;
}
}
File.WriteAllLines("../../../../dummydata/malha.txt", lines);
It seems like the double.NaN.ToString()
method, called from inside Point3D.ToString()
, includes that parenthesized "additional explanation" which I don't want at all.
Is there a way to change/override this method so that it outputs only NaN
, without the parentheses part?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…