Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Function test(PointX, PointY, Sommet1X, Sommet1Y, Sommet2X, Sommet2Y, Sommet3X, Sommet3Y, Sommet4X, Sommet4Y)
'angA
Dim pb = Math.Sqrt(((PointX - Sommet1X) * (PointX - Sommet1X)) + ((PointY - Sommet1Y) * (PointY - Sommet1Y)))
Dim pa = Math.Sqrt(((PointX - Sommet2X) * (PointX - Sommet2X)) + ((PointY - Sommet2Y) * (PointY - Sommet2Y)))
Dim ba = Math.Sqrt(((Sommet1X - Sommet2X) * (Sommet1X - Sommet2X)) + ((Sommet1Y - Sommet2Y) * (Sommet1Y - Sommet2Y)))
Dim radA = Math.Acos(((pa * pa) + (pb * pb) - (ba * ba)) / (2 * pa * pb))
Dim angA = radA * (180 / Math.PI)
'angB
pa = Math.Sqrt(((PointX - Sommet2X) * (PointX - Sommet2X)) + ((PointY - Sommet2Y) * (PointY - Sommet2Y)))
Dim pd = Math.Sqrt(((PointX - Sommet3X) * (PointX - Sommet3X)) + ((PointY - Sommet3Y) * (PointY - Sommet3Y)))
Dim ad = Math.Sqrt(((Sommet2X - Sommet3X) * (Sommet2X - Sommet3X)) + ((Sommet2Y - Sommet3Y) * (Sommet2Y - Sommet3Y)))
Dim radB = Math.Acos(((pa * pa) + (pd * pd) - (ad * ad)) / (2 * pa * pd))
Dim angB = radB * (180 / Math.PI)
'angC
pd = Math.Sqrt(((PointX - Sommet3X) * (PointX - Sommet3X)) + ((PointY - Sommet3Y) * (PointY - Sommet3Y)))
Dim pc = Math.Sqrt(((PointX - Sommet4X) * (PointX - Sommet4X)) + ((PointY - Sommet4Y) * (PointY - Sommet4Y)))
Dim dc = Math.Sqrt(((Sommet3X - Sommet4X) * (Sommet3X - Sommet4X)) + ((Sommet3Y - Sommet4Y) * (Sommet3Y - Sommet4Y)))
Dim radC = Math.Acos(((pc * pc) + (pd * pd) - (dc * dc)) / (2 * pc * pd))
Dim angC = radC * (180 / Math.PI)
'angD
pc = Math.Sqrt(((PointX - Sommet4X) * (PointX - Sommet4X)) + ((PointY - Sommet4Y) * (PointY - Sommet4Y)))
pb = Math.Sqrt(((PointX - Sommet1X) * (PointX - Sommet1X)) + ((PointY - Sommet1Y) * (PointY - Sommet1Y)))
Dim cb = Math.Sqrt(((Sommet4X - Sommet1X) * (Sommet4X - Sommet1X)) + ((Sommet4Y - Sommet1Y) * (Sommet4Y - Sommet1Y)))
Dim radD = Math.Acos(((pc * pc) + (pb * pb) - (cb * cb)) / (2 * pc * pb))
Dim angD = radD * (180 / Math.PI)
If angA + angB + angC + angD = 360 Then
Return True
Else : Return False
End If
End Function
...du polygone (dont je connais les coordonnées des sommets)....
25 nov. 2019 à 14:46
3 févr. 2021 à 19:52