hey yall text13.text box shows 2.48037E-03 number ,is that a + number ,if it is it conflicts with this >>(s >= 0# And s <= 1# And t >= 0# And t <= 1#)
it shows true but it shouldnt work because it is greater than this>>s <= 1#
thanks
Code:
Public Function SegmentsIntersect(ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single, ByVal A1 As Single, ByVal B1 As Single, ByVal A2 As Single, ByVal B2 As Single) As Boolean
Dim dx As Single
Dim dy As Single
Dim da As Single
Dim db As Single
Dim t As Single
Dim s As Single
dx = x2 - x1
dy = y2 - y1
da = A2 - A1
db = B2 - B1
If (da * dy - db * dx) = 0 Then
' The segments are parallel.
SegmentsIntersect = False
Exit Function
End If
s = (dx * (B1 - y1) + dy * (x1 - A1)) / (da * dy - db * dx)
t = (da * (y1 - B1) + db * (A1 - x1)) / (db * dx - da * dy)
SegmentsIntersect = (s >= 0# And s <= 1# And t >= 0# And t <= 1#)
Text13.Text = s '2.48037E-03
Text14.Text = t '0.3147531
'(s >= 0# And s <= 1# And t >= 0# And t <= 1#)
End Function