Thread
или AsyncTask
. for squadPupils in squads:
first = squadPupils[0]
last =squadPupils[len(squadPupils)-1]
b = int(len(squadPupils)-1)
last =squadPupils[b]
public static boolean isLinesIntercepts(Pair<Float, Float> start1, Pair<Float, Float> end1, Pair<Float, Float> start2, Pair<Float, Float> end2) {
double vector1 = (end2.first - start2.first) * (start1.second - start2.second) - (end2.second - start2.second) * (start1.first - start2.first);
double vector2 = (end2.first - start2.first) * (end1.second - start2.second) - (end2.second - start2.second) * (end1.first - start2.first);
double vector3 = (end1.first - start1.first) * (start2.second - start1.second) - (end1.second - start1.second) * (start2.first - start1.first);
double vector4 = (end1.first - start1.first) * (end2.second - start1.second) - (end1.second - start1.second) * (end2.first - start1.first);
return ((vector1 * vector2 <= 0) && (vector3 * vector4 <= 0));
}