public double GetBoundingBoxArea() { List <Coordonnees> coords = Coordonnees; Coordonnees topLeft = new Coordonnees(coords[0]), bottomRight = new Coordonnees(coords[0]); for (int i = 1; i < Coordonnees.Count(); i++) { if (coords[i].Latitude > bottomRight.Latitude) { bottomRight.Latitude = coords[i].Latitude; } else if (coords[i].Latitude < topLeft.Latitude) { topLeft.Latitude = coords[i].Latitude; } if (coords[i].Longitude > topLeft.Longitude) { topLeft.Longitude = coords[i].Longitude; } else if (coords[i].Longitude < bottomRight.Longitude) { bottomRight.Longitude = coords[i].Longitude; } } return((bottomRight.Latitude - topLeft.Latitude) * (topLeft.Longitude - bottomRight.Longitude)); }
public double GetPerimeter() { double perimeter = 0; for (int i = 0; i < Coordonnees.Count() - 1; i++) { perimeter += ZZMath.GetDistance((ZZCoordinate)Coordonnees[i], (ZZCoordinate)Coordonnees[i + 1]); } return(perimeter); }
public override bool IsPointClose(Coordonnees toCheck, double precision) { for (int i = 0; i < Coordonnees.Count() - 1; i++) { if (ZZMath.GetDistancePointToLine((ZZCoordinate)Coordonnees[i], (ZZCoordinate)Coordonnees[i + 1], (ZZCoordinate)toCheck) < precision) { return(true); } } return(false); }
private Coordonnees GetBottomRight() { Coordonnees bottomRight = new Coordonnees(); if (NbPoints > 0) { bottomRight = new Coordonnees(Coordonnees[0]); for (int i = 1; i < Coordonnees.Count(); i++) { if (Coordonnees[i].Latitude > bottomRight.Latitude) { bottomRight.Latitude = Coordonnees[i].Latitude; } if (Coordonnees[i].Longitude < bottomRight.Longitude) { bottomRight.Longitude = Coordonnees[i].Longitude; } } } return(bottomRight); }
private Coordonnees GetTopLeft() { Coordonnees topLeft = new Coordonnees(); if (NbPoints > 0) { topLeft = new Coordonnees(Coordonnees[0]); for (int i = 1; i < Coordonnees.Count(); i++) { if (Coordonnees[i].Latitude < topLeft.Latitude) { topLeft.Latitude = Coordonnees[i].Latitude; } if (Coordonnees[i].Longitude > topLeft.Longitude) { topLeft.Longitude = Coordonnees[i].Longitude; } } } return(topLeft); }