nog rare dinge, ma tga beter of normaal

This commit is contained in:
BuildTools
2020-07-29 17:31:07 +02:00
parent 824860dc58
commit 9f1da145a0
56 changed files with 289 additions and 47 deletions

View File

@@ -42,7 +42,7 @@ namespace Logica
return TriangulatePolygon(polygon);
}
private PolygonPunten ScalePolygon(PolygonPunten polygon, double scaleX, double scaleY)
public PolygonPunten ScalePolygon(PolygonPunten polygon, double scaleX, double scaleY)
{
double maxX = polygon.MaximumX;
double maxY = polygon.MaximumY;
@@ -65,6 +65,35 @@ namespace Logica
return new PolygonPunten(returnWaarde, polygon.Naam);
}
public MultiPolygonPunten ScaleMultiPolygon(MultiPolygonPunten multiPolygon, double scaleX, double scaleY)
{
double maxX = multiPolygon.MaximumX;
double maxY = multiPolygon.MaximumY;
double minX = multiPolygon.MinimumX;
double minY = multiPolygon.MinimumY;
maxX -= minX;
maxY -= minY;
List<PolygonPunten> pp = new List<PolygonPunten>();
foreach (PolygonPunten polygon in multiPolygon.PolygonPunten)
{
List<Punt> returnWaarde = new List<Punt>();
foreach (Punt punt in polygon.Punten)
{
double x = punt.X - minX;
x /= maxX;
x *= scaleX;
double y = punt.Y - minY;
y /= maxY;
y *= scaleY;
returnWaarde.Add(new Punt(x, y, punt.Naam));
}
pp.Add(new PolygonPunten(returnWaarde, polygon.Naam));
}
return new MultiPolygonPunten(pp, multiPolygon.Naam);
}
public List<PolygonPunten> GetAllPolygons()
{
List<PolygonPunten> lijst = new List<PolygonPunten>();