I am running the following code. However, the if condition is never not set to true wrongly. Any idea please?
private static int MinFirst(Coordinate First, Coordinate[] Coords) {
int foundFirst = 0;
double dFirst = 0;
double firstMinDist = Coords[0].distance(First);
for (int i = 1; i < Coords.length; i++) {
dFirst = Coords[i].distance(First);
if (dFirst < firstMinDist) {
foundFirst = i;
firstMinDist = dFirst;
}
}
return foundFirst;
}
Aucun commentaire:
Enregistrer un commentaire