Bonjour a tous,
j'ai le sujet d'exo suivant mais je vois pas comment faire.
The input and output arguments for this function are explained below:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 function flag = triangle_intersection(P1, P2) %triangle test : returns true if the triangles overlap and false otherwise
P1, P2 : a 3 by 2 array (each), describing the vertices of a triangle, the first row corresponds to the x coordinates while the second row corresponds to the y coordinates.
Flag : Return value for the function, set to true if it determines that the triangles do intersect and false otherwise.
One approach to writing this function is to consider all 6 edges, 3 for each triangle, for each edge determine whether it acts as a separating line where all of the vertices of one triangle lie on one side and all the vertices for the other triangle on the other side.
si quelqu'un peux m'aider ca serais sympas.
merci a tous
Partager