1 using System.Collections.Generic;
31 private readonly List<ColorPoint3D> points =
new List<ColorPoint3D>();
40 this.points.Add(point);
49 public void Write(
string fileName)
51 StreamWriter streamWriter =
new StreamWriter(fileName);
52 streamWriter.Write(this.CreateHeader());
56 streamWriter.WriteLine(
"{0} {1} {2} {3}", (
float)point.
X, (
float)point.
Y, (
float)point.
Z, (
int)point.
Color.R << 16|(
int)point.
Color.G<<8|(
int)point.
Color.B);
62 private string CreateHeader()
64 StringBuilder builder =
new StringBuilder();
65 builder.AppendLine(
"VERSION .7");
66 builder.AppendLine(
"FIELDS x y z rgb");
67 builder.AppendLine(
"SIZE 4 4 4 4");
68 builder.AppendLine(
"TYPE F F F F");
69 builder.AppendLine(
"COUNT 1 1 1 1");
70 builder.AppendLine($
"WIDTH {this.points.Count}");
71 builder.AppendLine(
"HEIGHT 1");
72 builder.AppendLine(
"VIEWPOINT 0 0 0 1 0 0 0");
73 builder.AppendLine($
"POINTS {this.points.Count}");
74 builder.AppendLine(
"DATA ascii");
75 return builder.ToString();
void AddPoint(ColorPoint3D point)
Adds the point.
double Z
Gets or sets the z.
double Y
Gets or sets the y.
double X
Gets or sets the x.
Color Color
Gets or sets the color.
void Write(string fileName)
Writes to specified file name.
Interface for writing points to file