morge nog es kijke

This commit is contained in:
BuildTools
2020-07-21 02:08:11 +02:00
parent e2ad21125a
commit 6a53d002e2
7 changed files with 21 additions and 4 deletions

View File

@@ -80,12 +80,20 @@ namespace opdracht2
{ {
List<System.Windows.Shapes.Polygon> returnWaarde = new List<System.Windows.Shapes.Polygon>(); List<System.Windows.Shapes.Polygon> returnWaarde = new List<System.Windows.Shapes.Polygon>();
int i = 0; int i = 0;
int BACKUP = 0;
int BACKBACKUP = polygonLijst.Count;
while (true) while (true)
{ {
if (i >= polygonLijst.Count) if (i >= polygonLijst.Count)
{ {
i = 0; i = 0;
if (polygonLijst.Count == BACKBACKUP)
{
BACKUP++;
}
BACKBACKUP = polygonLijst.Count;
} }
int punt1Index = i; int punt1Index = i;
@@ -107,13 +115,16 @@ namespace opdracht2
returnWaarde.Add(CreateNewPolygon(polygonLijst[punt1Index], polygonLijst[punt2Index], returnWaarde.Add(CreateNewPolygon(polygonLijst[punt1Index], polygonLijst[punt2Index],
polygonLijst[punt3Index])); polygonLijst[punt3Index]));
polygonLijst.RemoveAt(punt2Index); polygonLijst.RemoveAt(punt2Index);
Debug.WriteLine("added a triangle, polygonLijst count " + polygonLijst.Count);
} }
//Debug.WriteLine(hoek);
i++; i++;
if (BACKUP == 5) break;
} }
return returnWaarde; return returnWaarde;
@@ -122,7 +133,13 @@ namespace opdracht2
//https://stackoverflow.com/a/31334882 //https://stackoverflow.com/a/31334882
private static double GetAngle(Point p1, Point p2, Point p3) private static double GetAngle(Point p1, Point p2, Point p3)
{ {
return Math.Atan2(p3.Y - p1.Y, p3.X - p1.X) - Math.Atan2(p2.Y - p1.Y, p2.X - p1.X); double waarde = (Math.Atan2(p3.Y - p1.Y, p3.X - p1.X) - Math.Atan2(p2.Y - p1.Y, p2.X - p1.X)) * (180 / Math.PI);
if (waarde < -180)
{
waarde += 180;
}
return waarde;
} }

View File

@@ -10,10 +10,10 @@ none
false false
TRACE;DEBUG;NETCOREAPP;NETCOREAPP3_1 TRACE;DEBUG;NETCOREAPP;NETCOREAPP3_1
C:\Users\Beppe\source\repos\opdracht2\opdracht2\App.xaml C:\Users\Beppe\source\repos\opdracht2\opdracht2\App.xaml
1-673581283 1-1960587782
4543106357 4-1321365794
195-2120402724 195-2056577357
MainWindow.xaml; MainWindow.xaml;
False False