-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunctions.cs
4933 lines (4273 loc) · 135 KB
/
Functions.cs
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
namespace AI
{
class F
{
public Random random = new Random((int)(DateTime.Now.Ticks));
float[] z; // z*100
float[,] tValues;
float[] tValueSig, tValueDf;
double INF = double.PositiveInfinity;
PointF pINF = new PointF(float.PositiveInfinity, float.PositiveInfinity);
Point origin = new Point();
v3 v3Origin = new v3();
float randomCounter;
public F()
{
Set_NormalDistributionValues();
Set_tValues();
}
#region String
//-----------------------------------------------------------------------
public string ToString(Array arr, string separator)
{
if (arr.Length == 0)
{
return "{ }";
}
string str = "{";
int c = arr.Length;
for (int i = 0; i < c; i++)
{
if (i != 0)
{
str += separator;
}
str += arr.GetValue(i);
}
str += "}";
return str;
}
public string ToString(float[,] frequencies)
{
int c = frequencies.GetLength(0);
if (c == 0)
{
return "";
}
string str = "";
for (int i = 0; i < c; i++)
{
str += frequencies[i, 0] + " x " + frequencies[i, 1] + Environment.NewLine;
}
return str;
}
public string ToString(DateTime value, DateTime omitIntersect1, DateTime omitIntersect2, out string omitted)
{
bool day, month, year, hour, timeOfDay, minute, second, omitTime;
string str, dateStr, timeStr, dateOmitted, timeOmitted, tempStr;
str = "";
omitted = "";
dateOmitted = "";
timeOmitted = "";
dateStr = "";
timeStr = "";
day = true;
month = true;
year = true;
hour = true;
timeOfDay = true;
minute = true;
second = true;
omitTime = false;
if (omitIntersect1.Year == omitIntersect2.Year)
{
year = false;
if (omitIntersect1.Month == omitIntersect2.Month)
{
month = false;
if (omitIntersect1.Day == omitIntersect2.Day)
{
day = false;
if (omitIntersect1.TimeOfDay == omitIntersect2.TimeOfDay)
{
timeOfDay = false;
if (omitIntersect1.Hour == omitIntersect2.Hour)
{
hour = false;
if (omitIntersect1.Minute == omitIntersect2.Minute)
{
minute = false;
if (omitIntersect1.Second == omitIntersect2.Second)
{
second = false;
}
}
}
}
}
}
}
string date, time;
date = Regex.Match(omitIntersect1.ToString(), ".*?( )").Value;
date = date.Trim();
time = Regex.Match(omitIntersect1.ToString(), "( ).*").Value;
time = time.Trim();
//omit time
if (hour & timeOfDay & minute & second)
{
if (time == "12:00:00 a.m.")
{
omitTime = true;
}
}
//all different
if (day & month & year & hour & timeOfDay & minute & second)
{
return value.ToString();
}
if (!day & !month & !year & !hour & !timeOfDay & !minute & !second)
{
return value.ToString();
}
//date -----
//day
if (day)
{
if (dateStr == "")
{
dateStr = value.Day.ToString();
}
else
{
dateStr += "/" + value.Day;
}
}
else
{
if (dateOmitted == "")
{
dateOmitted = value.Day.ToString();
}
else
{
dateOmitted += "/" + value.Day;
}
}
//month
if (month)
{
if (dateStr == "")
{
dateStr = value.Month.ToString();
}
else
{
dateStr += "/" + value.Month;
}
}
else
{
if (dateOmitted == "")
{
dateOmitted = value.Month.ToString();
}
else
{
dateOmitted += "/" + value.Month;
}
}
//year
if (year)
{
if (dateStr == "")
{
dateStr = value.Year.ToString();
}
else
{
dateStr += "/" + value.Year;
}
}
else
{
if (dateOmitted == "")
{
dateOmitted = value.Year.ToString();
}
else
{
dateOmitted += "/" + value.Year;
}
}
//time -----
if (!omitTime)
{
//hour
if (hour)
{
if (timeStr == "")
{
timeStr = value.Hour.ToString();
}
else
{
timeStr += ":" + value.Hour;
}
}
else
{
if (timeOmitted == "")
{
timeOmitted = value.Hour.ToString();
}
else
{
timeOmitted += ":" + value.Hour;
}
}
//minute
if (minute)
{
if (value.Minute.ToString().Length == 1)
{
tempStr = "0" + value.Minute;
}
else
{
tempStr = value.Minute.ToString();
}
if (timeStr == "")
{
timeStr = tempStr;
}
else
{
timeStr += ":" + tempStr;
}
}
else
{
if (value.Minute.ToString().Length == 1)
{
tempStr = "0" + value.Minute;
}
else
{
tempStr = value.Minute.ToString();
}
if (timeOmitted == "")
{
timeOmitted = tempStr;
}
else
{
timeOmitted += ":" + tempStr;
}
}
//second
if (second)
{
if (value.Second.ToString().Length == 1)
{
tempStr = "0" + value.Second;
}
else
{
tempStr = value.Second.ToString();
}
if (timeStr == "")
{
timeStr = tempStr;
}
else
{
timeStr += ":" + tempStr;
}
}
else
{
if (value.Second.ToString().Length == 1)
{
tempStr = "0" + value.Second;
}
else
{
tempStr = value.Second.ToString();
}
if (timeOmitted == "")
{
timeOmitted = tempStr;
}
else
{
timeOmitted += ":" + tempStr;
}
}
////timeOfDay
//if (timeOfDay)
//{
// if (timeStr == "")
// {
// timeStr = value.TimeOfDay.ToString();
// }
// else
// {
// timeStr += " " + value.TimeOfDay;
// }
//}
//else
//{
// if (timeOmitted == "")
// {
// timeOmitted = value.TimeOfDay.ToString();
// }
// else
// {
// timeOmitted += " " + value.TimeOfDay;
// }
//}
}
//compile ----
if (dateStr != "")
{
str = dateStr;
if (timeStr != "")
{
str += " " + timeStr;
}
}
if (dateOmitted != "")
{
omitted = dateOmitted;
if (timeStr != "")
{
omitted += " " + timeOmitted;
}
}
return str;
}
public string ToString(DateTime value, DateTime omitIntersect1, DateTime omitIntersect2)
{
string s;
return ToString(value, omitIntersect1, omitIntersect2, out s);
}
public int MeasureString(string text, Font font, System.Windows.Forms.PaintEventArgs e)
{
return (int)e.Graphics.MeasureString(text, font).Width;
}
public int MeasureString(float value, Font font, System.Windows.Forms.PaintEventArgs e)
{
//if (value == 0)
//{
// float n = 1;
// return MeasureString(n.ToString(), font, e);
//}
return MeasureString(value.ToString(), font, e);
}
public int MeasureString(int value, Font font, System.Windows.Forms.PaintEventArgs e)
{
//if (value == 0)
//{
// float n = 1;
// return MeasureString(n.ToString(), font, e);
//}
return MeasureString(value.ToString(), font, e);
}
//-----------------------------------------------------------------------
#endregion
#region Maths
//-----------------------------------------------------------------------
public v3 Add(v3 v1, v3 v2)
{
return new v3(v1.X + v2.X, v1.Y + v2.Y, v1.Z + v2.Z);
}
public PointF Add(PointF v1, PointF v2)
{
return new PointF(v1.X + v2.X, v1.Y + v2.Y);
}
public Point Add(Point v1, Point v2)
{
return new Point(v1.X + v2.X, v1.Y + v2.Y);
}
public Collection<object> Add(Collection<object> addTo, Collection<object> itemsToAdd)
{
int c = itemsToAdd.Count;
if (c == 0)
{
return addTo;
}
for (int i = 0; i < c; i++)
{
addTo.Add(itemsToAdd[i]);
}
return addTo;
}
public float Add(float n1, float n2)
{
return n1 + n2;
}
public DateTime Add(DateTime addTo, TimeSpan amount)
{
return new DateTime(addTo.Ticks + amount.Ticks);
}
public v3 Subtract(v3 subtractFrom, v3 subtractBy)
{
return new v3(subtractFrom.X - subtractBy.X, subtractFrom.Y - subtractBy.Y, subtractFrom.Z - subtractBy.Z);
}
public PointF Subtract(PointF subtractFrom, PointF subtractBy)
{
return new PointF(subtractFrom.X - subtractBy.X, subtractFrom.Y - subtractBy.Y);
}
public Point Subtract(Point subtractFrom, Point subtractBy)
{
return new Point(subtractFrom.X - subtractBy.X, subtractFrom.Y - subtractBy.Y);
}
public PointF Dir(PointF p1, PointF p2)
{
return new PointF(p2.X - p1.X, p2.Y - p1.Y);
}
public v3 Divide(v3 numeratorVector, v3 denominatorVector)
{
return new v3(numeratorVector.X / denominatorVector.X,
numeratorVector.Y / denominatorVector.Y,
numeratorVector.Z / denominatorVector.Z);
}
public v3 Divide(v3 numeratorVector, double denominator)
{
return new v3(numeratorVector.X / denominator,
numeratorVector.Y / denominator,
numeratorVector.Z / denominator);
}
public float Divide(TimeSpan numerator, TimeSpan denominator)
{
return numerator.Ticks / denominator.Ticks;
}
public TimeSpan Divide(TimeSpan numerator, double denominator)
{
return new TimeSpan((long)(numerator.Ticks / denominator));
}
public PointF Divide(PointF numeratorVector, float denominator)
{
return new PointF(numeratorVector.X / denominator,
numeratorVector.Y / denominator);
}
public float Divide(float numeratorVector, float denominator)
{
float n;
n = numeratorVector / denominator;
if (float.IsNaN(n))
{
return 0;
}
return n;
}
public PointF Multiply(PointF vector, float multiplier)
{
PointF p = new PointF(0, 0);
p.X = vector.X * multiplier;
p.Y = vector.Y * multiplier;
return p;
}
public Point Multiply(Point vector, float multiplier)
{
Point p = new Point(0, 0);
p.X = (int)((float)vector.X * multiplier);
p.Y = (int)((float)vector.Y * multiplier);
return p;
}
public v3 Multiply(v3 vector, double multiplier)
{
return new v3(vector.X * multiplier,
vector.Y * multiplier,
vector.Z * multiplier);
}
public TimeSpan Multiply(TimeSpan timeSpan, double multiplier)
{
return new TimeSpan((long)(timeSpan.Ticks * multiplier));
}
public v3 Abs(v3 v)
{
return new v3(Math.Abs(v.X), Math.Abs(v.Y), Math.Abs(v.Z));
}
public int Abs(int n)
{
if (n < 0)
{
return -n;
}
return n;
}
public float Abs(float n)
{
if (n < 0)
{
return -n;
}
return n;
}
public double Abs(double n)
{
if (n < 0)
{
return -n;
}
return n;
}
public double Pow(double n, double power)
{
return Math.Pow(n, power);
}
public double E(double n, double exponent)
{
return n * Math.Pow(10, exponent);
}
public float Magnitude(PointF vector)
{
return (float)System.Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
}
public double Magnitude(v2 vector)
{
return System.Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
}
public double Magnitude(v3 v)
{
return System.Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z);
}
public double Magnitude(double x, double y)
{
return System.Math.Sqrt(x * x + y * y);
}
public double Magnitude(double x, double y, double z)
{
return System.Math.Sqrt(x * x + y * y + z * z);
}
public float Magnitude(float x, float y)
{
return (float)System.Math.Sqrt(x * x + y * y);
}
public float Distance(PointF p1, PointF p2)
{
float d;
d = (float)Math.Sqrt((p2.X - p1.X) * (p2.X - p1.X) +
(p2.Y - p1.Y) * (p2.Y - p1.Y));
return d;
}
public float Distance(Point p1, Point p2)
{
float d;
d = (float)Math.Sqrt((p2.X - p1.X) * (p2.X - p1.X) +
(p2.Y - p1.Y) * (p2.Y - p1.Y));
return d;
}
public double Distance(v2 p1, v2 p2)
{
double d;
d = Math.Sqrt((p2.X - p1.X) * (p2.X - p1.X) +
(p2.Y - p1.Y) * (p2.Y - p1.Y));
return d;
}
public double Distance(v3 v1, v3 v2)
{
double d;
d = Math.Sqrt((v2.X - v1.X) * (v2.X - v1.X) +
(v2.Y - v1.Y) * (v2.Y - v1.Y) +
(v2.Z - v1.Z) * (v2.Z - v1.Z));
return d;
}
public PointF Average(PointF p1, PointF p2)
{
return new PointF((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2);
}
public double Bearing(PointF Direction)
{
if (Direction == new PointF(0, 0))
{
return 0;
}
double angle, r;
PointF A;
r = Magnitude(Direction);
A = Direction;
angle = Math.Asin(A.X / r);
if (A.Y > 0)
{
angle = Math.PI / 2 - angle + Math.PI / 2;
}
if (A.X < 0 && A.Y <= 0)
{
angle = Math.PI * 2 + angle;
}
if (angle > Math.PI * 2)
{
angle = Math.PI * 2 - angle;
}
return angle;
}
public double Bearing(v2 Direction)
{
if (Direction == new v2(0, 0))
{
return 0;
}
double angle, r;
v2 A;
r = Magnitude(Direction);
A = Direction;
angle = Math.Asin(A.X / r);
if (A.Y > 0)
{
angle = Math.PI / 2 - angle + Math.PI / 2;
}
if (A.X < 0 && A.Y <= 0)
{
angle = Math.PI * 2 + angle;
}
if (angle > Math.PI * 2)
{
angle = Math.PI * 2 - angle;
}
return angle;
}
public float Gradient(PointF p1, PointF p2)
{
if (p1 == p2)
{
return 0;
}
float m;
m = (p2.Y - p1.Y) / (p2.X - p1.X);
return m;
}
public int NumberDirection(double num)
{
if (num == 0)
{
return 0;
}
else if (num > 0)
{
return 1;
}
else
{
return -1;
}
}
public Point FourDirectionalPoint(PointF trueDirection)
{
Point p = new Point(0, 0);
if (trueDirection.X > 0)
{
p.X = 1;
}
if (trueDirection.X < 0)
{
p.X = -1;
}
if (trueDirection.Y > 0)
{
p.Y = 1;
}
if (trueDirection.Y < 0)
{
p.Y = -1;
}
//Console.WriteLine("Received: " + trueDirection + ". Returned: " + p);
return p;
}
public Point RandomPoint(PointF minInclusive, PointF maxExclusive)
{
Point p;
p = new Point(random.Next((int)(minInclusive.X), (int)(maxExclusive.X)),
random.Next((int)(minInclusive.Y), (int)(maxExclusive.Y)));
return p;
}
public v3 RandomVector()
{
return new v3(random.Next(-10, 10), random.Next(-10, 10), random.Next(-10, 10));
}
public PointF RandomPointWithOffset(PointF center, float offset)
{
PointF p, rn;
rn = new PointF(0, 0);
while (rn == new PointF(0, 0))
{
rn.X = random.Next(-10, 10);
rn.Y = random.Next(-10, 10);
}
p = Offset(rn, offset);
p = AddPoints(p, center);
return p;
}
public PointF AddPoints(PointF Vector1, PointF Vector2)
{
PointF d;
d = new PointF(Vector2.X + Vector1.X, Vector2.Y + Vector1.Y);
return d;
}
public Point AddPoints(Point Vector1, Point Vector2)
{
Point d;
d = new Point(Vector2.X + Vector1.X, Vector2.Y + Vector1.Y);
return d;
}
public PointF Opposite(PointF vector)
{
PointF v;
v = new PointF(-vector.X, -vector.Y);
return v;
}
public Point Opposite(Point vector)
{
Point v;
v = new Point(-vector.X, -vector.Y);
return v;
}
public v3 Opposite(v3 vector)
{
v3 v;
v = new v3(-vector.X, -vector.Y, -vector.Z);
return v;
}
public v3 Diff(v3 v1, v3 v2)
{
v3 d;
d = new v3(v2.X - v1.X, v2.Y - v1.Y, v2.Z - v1.Z);
return d;
}
public PointF Diff(PointF Vector1, PointF Vector2)
{
PointF d;
d = new PointF(Vector2.X - Vector1.X, Vector2.Y - Vector1.Y);
return d;
}
public Point Diff(Point Vector1, Point Vector2)
{
Point d;
d = new Point(Vector2.X - Vector1.X, Vector2.Y - Vector1.Y);
return d;
}
public PointF Offset(PointF dir, float dist)
{
if (dir == new PointF() | dist == 0)
{
return new PointF();
}
float d = Magnitude(dir);
float multiplier = dist / d;
return new PointF(dir.X * multiplier, dir.Y * multiplier);
}
public v3 Offset(v3 dir, double dist)
{
if (dir == new v3())
{
return new v3();
}
double d = Magnitude(dir);
if (d != 0)
{
double multiplier = dist / d;
v3 v;
v = new v3(dir.X * multiplier, dir.Y * multiplier, dir.Z * multiplier);
//Console.WriteLine("dist: " + dist + ". Returned: " + Magnitude3D(v));
return v;
}
else
{
return v3Origin;
}
}
public PointF MidPoint(PointF v1, PointF v2)
{
return new PointF((v1.X + v2.X) / 2, (v1.Y + v2.Y) / 2);
}
public v3 MidPoint(v3 v1, v3 v2)
{
return new v3((v1.X + v2.X) / 2, (v1.Y + v2.Y) / 2, (v1.Z + v2.Z) / 2);
}
public v3 MidPoint(v3 v)
{
return new v3(v.X / 2, v.Y / 2, v.Z / 2);
}
public PointF[] MiddlePoint_x2(PointF Vect1, PointF Vect2)
{
PointF[] p = new PointF[3];
p[1] = MidPoint(Vect1, Vect2);
p[0] = MidPoint(p[1], Vect1);
p[2] = MidPoint(p[1], Vect2);
return p;
}
public PointF VectorPart(PointF Component, PointF Direction)
{
if (Direction == new PointF() | Component == new PointF())
{
return new PointF();
}
PointF returnValue;
//Env.Deb.AddVector(New Point(0, 0), New Point(Component.X, Component.Y), "Component", True)
//Env.Deb.AddVector(New Point(0, 0), New Point(DirectionDiff.X, DirectionDiff.Y), "DirectionDiff", False)
if (Direction != new PointF(0, 0) && Component != Direction)
{
double Angle;
Angle = AngleBetween(Component, Direction);
if (Angle != 0)
{
if (Angle != System.Math.PI)
{
if (Angle != System.Math.PI / 2)
{
//find VectorPart from SOH
double ComponentLength;
double VectorPartLength;
ComponentLength = Magnitude(Component);
VectorPartLength = ComponentLength * System.Math.Cos(Angle);
if ((Direction.X == 0 && Direction.Y < 0) || (Direction.X < 0 && Direction.Y == 0))
{
VectorPartLength = -VectorPartLength;
}
returnValue = Offset(Direction, (float)VectorPartLength);
//End If
//Env.Deb.AddVector(New Point(0, 0), New Point(-VectorPart.X, -VectorPart.Y), "-VectorPart", True)
//Env.Deb.Vectors.Clear()
}
else
{
returnValue = new PointF(0, 0);
}
}
else
{
returnValue = new PointF(-Component.X, -Component.Y);
}
}
else
{
returnValue = Component;
}
}
else
{
returnValue = Component;
}
//Debug.WriteLine("Received Component: " & Component.ToString & ", DirectionDiff: " & DirectionDiff.ToString & ". Returned: " & VectorPart.ToString)
return returnValue;
}
public v3 VectorPart(v3 Component, v3 Direction)
{
if (Direction == new v3())
{
return new v3();
}
v3 returnValue;
//Env.Deb.AddVector(New Point(0, 0), New Point(Component.X, Component.Y), "Component", True)
//Env.Deb.AddVector(New Point(0, 0), New Point(DirectionDiff.X, DirectionDiff.Y), "DirectionDiff", False)
if (Direction != new v3() && Component != Direction)
{
double Angle;
Angle = AngleBetween(Component, Direction);
if (Angle != 0)
{
if (Angle != System.Math.PI)
{