Removed spaces from top-level directory names.

Spaces tend to cause annoyances in a Unix-style shell environment.
This change fixes that.
This commit is contained in:
Chris Reuter
2021-11-21 18:30:21 -05:00
parent df2e7426eb
commit d26dbf036a
1725 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
namespace Plot
{
internal static class Function
{
internal static IEnumerable<IEnumerable<int>> GetRows()
{
for (var x = -30f; x <= 30f; x += 1.5f)
{
yield return GetValues(x);
}
}
private static IEnumerable<int> GetValues(float x)
{
var zPrevious = 0;
var yLimit = 5 * (int)(Math.Sqrt(900 - x * x) / 5);
for (var y = yLimit; y >= -yLimit; y -= 5)
{
var z = GetValue(x, y);
if (z > zPrevious)
{
zPrevious = z;
yield return z;
}
}
}
private static int GetValue(float x, float y)
{
var r = (float)Math.Sqrt(x * x + y * y);
return (int)(25 + 30 * Math.Exp(-r * r / 100) - 0.7f * y);
}
}
}

View File

@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,38 @@
using System;
namespace Plot
{
class Program
{
static void Main(string[] args)
{
PrintTitle();
foreach (var row in Function.GetRows())
{
foreach (var z in row)
{
Plot(z);
}
Console.WriteLine();
}
}
private static void PrintTitle()
{
Console.WriteLine(" 3D Plot");
Console.WriteLine(" Creative Computing Morristown, New Jersey");
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
}
private static void Plot(int z)
{
var x = Console.GetCursorPosition().Top;
Console.SetCursorPosition(z, x);
Console.Write("*");
}
}
}