private void DrawPoints(StreamWriter eps, Mesh mesh, bool label)
{
int n = mesh.Vertices.Count;
int circle_size = 1;
if (n < 100)
{
circle_size = 3;
}
else if (n < 500)
{
circle_size = 2;
}
eps.WriteLine("%");
eps.WriteLine("% Draw filled dots at the nodes.");
eps.WriteLine("%");
eps.WriteLine("% Set the RGB color to blue.");
eps.WriteLine("%");
eps.WriteLine("0.0 0.4 0.0 setrgbcolor");
eps.WriteLine("%");
double x, y;
int x_ps, y_ps;
StringBuilder labels = new StringBuilder();
foreach (var node in mesh.Vertices)
{
x = node.X;
y = node.Y;
x_ps = (int)Math.Floor(((x_max - x) * x_ps_min + (x - x_min) * x_ps_max) / (x_max - x_min));
y_ps = (int)Math.Floor(((y_max - y) * y_ps_min + (y - y_min) * y_ps_max) / (y_max - y_min));
eps.WriteLine(" newpath {0} {1} {2} 0 360 arc closepath fill", x_ps, y_ps, circle_size);
if (label)
{
labels.AppendFormat(" {0} {1} moveto ({2}) show", x_ps, y_ps + 5, node);
labels.AppendLine();
}
}
// Label the nodes.
if (label)
{
eps.WriteLine("%");
eps.WriteLine("% Label the nodes.");
eps.WriteLine("%");
eps.WriteLine("% Set the RGB color to darker blue.");
eps.WriteLine("%");
eps.WriteLine("0.000 0.250 0.850 setrgbcolor");
eps.WriteLine("/Times-Roman findfont");
eps.WriteLine("0.20 inch scalefont");
eps.WriteLine("setfont");
eps.WriteLine("%");
eps.Write(labels.ToString());
}
}