-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
184 lines (143 loc) · 6.52 KB
/
Program.cs
File metadata and controls
184 lines (143 loc) · 6.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/* * * Program.cs * * */
// ORIGINAL FILE for entry point
// This is Flattend SRC_CS from another github repo
// For testing:
// DYNAMIC_CS_CPP_HAV_TEST.Program_test.Main_test();
namespace CS_Navigation;
using System; // System sauces
using System.Text; // Text stuffs
using System.Collections.Generic; // idk
// using System.Diagnostics;
using System.Runtime.CompilerServices; // Super Optimization
// using DYNAMIC_CS_CPP_HAV_TEST; // Testing
using DYNAMIC_CS_CPP_HAV; // The Experiment
/**/
// using Location; // Main sauce I
// using Haversine; // Main sauce II
// using Symbols; // Helper of main sauce
// using Distance; // The main dish along with the main sauce
// using Misc; // Very side dish
using OLD; // Old Program here
/// <summary>
/// Main entry point gate
/// </summary>
public class Program
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool CheckEqual(object Var1, object Var2)
{
return Equals(Var1, Var2);
// if (Var1 == Var2) {
// return true;
// }
// else {
// return false;
// }
}
/* TEMPLATE:
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IPB()
{
// [-6.588457, 106.806200]
// [-6.559582, 106.726720]
Console.WriteLine($"Current terminal size: {Misc.TerminalSize}");
Location SV_IPB = new Location("SV IPB", -6.588457, 106.806200, isRadian: false);
Location Danau_IPB = new Location("Danau IPB", -6.559582, 106.726720, isRadian: false);
SV_IPB.Printer();
Danau_IPB.Printer();
Console.WriteLine(Misc.PrintMid(Misc.PrintMid("Degree", '─', offset: -(Misc.TerminalSize / 2), LeftBorder: ' ', RightBorder: ' '), Char: ' ', LeftBorder: ' ', RightBorder: ' '));
// double D = nDistance.Distance_2D.Distance_Deg(SV_IPB, Danau_IPB);
double D = Distance.Distance_2D.Distance_Deg(SV_IPB, Danau_IPB);
Console.WriteLine(Misc.PrintMid(Misc.PrintMid("Radians", '─', offset: -(Misc.TerminalSize / 2), LeftBorder: ' ', RightBorder: ' '), Char: ' ', LeftBorder: ' ', RightBorder: ' '));
SV_IPB.toRadian();
Danau_IPB.toRadian();
// double R = nDistance.Distance_2D.Distance_Rad(SV_IPB, Danau_IPB);
double R = Distance.Distance_2D.Distance_Rad(SV_IPB, Danau_IPB);
Console.WriteLine(Misc.Repeater("~", Console.WindowWidth / 2));
Console.WriteLine($"Degrees = {D} KM");
Console.WriteLine($"Radians = {R} KM");
Console.WriteLine(CheckEqual(D, R) ? "APPROVED!" : "meh");
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void WikipediaExample()
{
Location WhiteHouse = new Location("White House WDC", 38.898, 77.037);
Location EffielTowr = new Location("Effiel Tower à Paris", 48.858, 2.294);
WhiteHouse.Printer();
EffielTowr.Printer();
Console.WriteLine(Misc.PrintMid(Misc.PrintMid("Degree", '─', offset: -(Misc.TerminalSize / 2), LeftBorder: ' ', RightBorder: ' '), Char: ' ', LeftBorder: ' ', RightBorder: ' '));
double D = Distance.Distance_2D.Distance_Deg(WhiteHouse, EffielTowr);
WhiteHouse.toRadian();
EffielTowr.toRadian();
Console.WriteLine(Misc.PrintMid(Misc.PrintMid("Radians", '─', offset: -(Misc.TerminalSize / 2), LeftBorder: ' ', RightBorder: ' '), Char: ' ', LeftBorder: ' ', RightBorder: ' '));
double R = Distance.Distance_2D.Distance_Rad(WhiteHouse, EffielTowr);
Console.WriteLine(Misc.Repeater("~", Console.WindowWidth / 2));
Console.WriteLine($"Degrees = {D} KM");
Console.WriteLine($"Radians = {R} KM");
Console.WriteLine(CheckEqual(D, R) ? "APPROVED!" : "meh");
}
*/
public static void ProgramMainRunner()
{
ProgramMainRunner(new Location(), new Location(), "");
}
private static void ProgramMainRunner(Location LocA, Location LocB, string tag = "")
{
if (tag != "")
{
Console.WriteLine(Misc.PrintMid(tag));
}
LocA.Printer();
LocB.Printer();
Console.WriteLine(Misc.PrintMid(Misc.PrintMid("Degree", '─', offset: -(Misc.TerminalSize / 2), LeftBorder: ' ', RightBorder: ' '), Char: ' ', LeftBorder: ' ', RightBorder: ' '));
double D = Distance.Distance_2D.Distance_Deg(LocA, LocB);
Console.WriteLine(Misc.PrintMid(Misc.PrintMid("Radians", '─', offset: -(Misc.TerminalSize / 2), LeftBorder: ' ', RightBorder: ' '), Char: ' ', LeftBorder: ' ', RightBorder: ' '));
LocA.toRadian();
LocB.toRadian();
double R = Distance.Distance_2D.Distance_Rad(LocA, LocB);
Console.WriteLine(Misc.Repeater("~", Console.WindowWidth / 2));
Console.WriteLine($"Degrees = {D} KM");
Console.WriteLine($"Radians = {R} KM");
Console.WriteLine(CheckEqual(D, R) ? "APPROVED!" : "meh");
}
public static void ENTRY_TEST()
{
// ProgramTestCoffe.Main_test();
}
public static void ENTRY_MAIN()
{
string TITLE = ColorTx.ColorStr("Haversine Implementation!");
Console.WriteLine(Misc.PrintMid(TITLE, ' ', LeftBorder: ' ', RightBorder: ' '));
Console.WriteLine($"Terminal size: {Misc.TerminalSize}");
// Save current color
// ConsoleColor CurrentColor = Console.BackgroundColor;
// Set color
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine(Misc.PrintMid("IPBs", '─'));
// Reset color
Console.ResetColor();
// IPB();
ProgramMainRunner(new Location("SV IPB", -6.588457, 106.806200, isRadian: false), new Location("Danau IPB", -6.559582, 106.726720, isRadian: false));
Console.WriteLine(Misc.Repeater("─", Misc.TerminalSize));
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine(Misc.PrintMid("WIkipedia Example", '─'));
Console.ResetColor();
// WikipediaExample();
ProgramMainRunner(new Location("White House WDC", 38.898, 77.037), new Location("Effiel Tower à Paris", 48.858, 2.294));
Console.WriteLine(Misc.Repeater("─", Misc.TerminalSize));
}
public static void Main()
{
try
{
// ENTRY_MAIN();
// ENTRY_TEST();
ProgramExt.ENTRY_MAIN_EXT();
}
catch (System.Exception)
{
throw;
}
}
}
/* * * End Program.cs * * */