Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Programme de calcul de distance entre des points

Aucune réponse
Avatar
Badou001
Hello dear community I am a new beginner in programming and I am having a problem I would like to develop a program which from a list of given points (a point is defined with its coordinates) divided this set of points into subsets such as the distance between all the points of this subset is strictly less than 20km the goal is to know how many subsets we will have and what are the points of each subset I said to myself that this algorithm works:
Let E = set of points x such that E = {X1, X2, X3, ...... Xn}
For i going from 0 to n we have
Fi = Xi
E = E - Fi
For j going from 0 to n and i! = J we have


If the distance between Xi and Xj is less than 20km then Fi = {Xi, Xj}
E = E - Fi
We display F1, F2, F3, .... Fn we stop when E is empty
Here is the idea for the algorithm I do not know if it will work but the problem is that I cannot code it I encountered problems with the arrays also with the notion of point defined with its coordinates also a problem distance calculation as well as the counter ... I'm stuck if you can help me or enlighten me thank you



Bonjour cher communauté je suis un nouveau débutant en programmation et je rencontre un problème je voudrais développer un programme qui a partir d'une liste de points donnés (un point est défini avec ses coordonnées) divisé cette ensemble de points en sous ensemble tel que la distance entre tout les points de cet sous ensemble est inférieur strictement à 20km le but est de savoir combien de sous ensemble on aura et que sont les points de chaque sous ensemble je me suis dit que cet algorithm marche :
Soit E = ensemble de points x tel que E={X1,X2,X3,......Xn}
Pour i allant de 0 à n on a
Fi = Xi
E= E - Fi
Pour j allant de 0 a n et i !=j on a


Si la distance entre Xi et Xj est inférieur à 20km alors Fi = {Xi,Xj}
E= E - Fi
On affiche F1,F2,F3,....Fn on arrête lorsque E est vide
Voilà l'idée pour lalgorithm je sais pas si ca va marcher mais le problème c'est que je n'arrive pas a le coder j'ai rencontré des problèmes avec les tableaux aussi avec la notion de point définie avec ses coordonnées aussi un problème de calcul de distance ainsi que le compteur ... je suis bloqué si vous pouvez m'aider ou m'éclairer je vous en remercie

Réponses