mike.lee771419
2019-05-23, 02:52 PM
Hello,
I have the following code to see if a selected line is horizontal or vertical but some lines that have the same StartY and EndY are still returning as angled. What am I missing? I even went so far as to restrain the line horizontal.
Public Shared Function HorizontalVerticle(Line As Line) As Tuple(Of String, Double, Double, Double, Double) 'Determin if line is horizontal or verticle
If Line.StartPoint.Y = Line.EndPoint.Y And Line.StartPoint.X <> Line.EndPoint.X Then
'MsgBox("Horizontal, " & Line.StartPoint.Y & vbCrLf & "Horizontal, " & Line.EndPoint.Y,, "HorizontalVerticle Function")
Dim y = New Tuple(Of String, Double, Double, Double, Double)("Horizontal", Line.StartPoint.Y, Line.StartPoint.X, Line.EndPoint.Y, Line.EndPoint.X)
Return y
ElseIf Line.StartPoint.X = Line.EndPoint.X And Line.StartPoint.Y <> Line.EndPoint.Y Then
'MsgBox("Verticle, " & Line.StartPoint.Y & vbCrLf & "Verticle, " & Line.EndPoint.Y,, "HorizontalVerticle Function")
Dim y = New Tuple(Of String, Double, Double, Double, Double)("Verticle", Line.StartPoint.Y, Line.StartPoint.X, Line.EndPoint.Y, Line.EndPoint.X)
Return y
ElseIf Line.StartPoint.X <> Line.EndPoint.X And Line.StartPoint.Y <> Line.EndPoint.Y Then
'MsgBox("Line is neither horizontal or verticle, " & Line.StartPoint.Y & vbCrLf & "Verticle, " & Line.EndPoint.Y,, "HorizontalVerticle Function")
Dim y = New Tuple(Of String, Double, Double, Double, Double)("Angled", Line.StartPoint.Y, Line.StartPoint.X, Line.EndPoint.Y, Line.EndPoint.X)
Return y
End If
End Function
I have the following code to see if a selected line is horizontal or vertical but some lines that have the same StartY and EndY are still returning as angled. What am I missing? I even went so far as to restrain the line horizontal.
Public Shared Function HorizontalVerticle(Line As Line) As Tuple(Of String, Double, Double, Double, Double) 'Determin if line is horizontal or verticle
If Line.StartPoint.Y = Line.EndPoint.Y And Line.StartPoint.X <> Line.EndPoint.X Then
'MsgBox("Horizontal, " & Line.StartPoint.Y & vbCrLf & "Horizontal, " & Line.EndPoint.Y,, "HorizontalVerticle Function")
Dim y = New Tuple(Of String, Double, Double, Double, Double)("Horizontal", Line.StartPoint.Y, Line.StartPoint.X, Line.EndPoint.Y, Line.EndPoint.X)
Return y
ElseIf Line.StartPoint.X = Line.EndPoint.X And Line.StartPoint.Y <> Line.EndPoint.Y Then
'MsgBox("Verticle, " & Line.StartPoint.Y & vbCrLf & "Verticle, " & Line.EndPoint.Y,, "HorizontalVerticle Function")
Dim y = New Tuple(Of String, Double, Double, Double, Double)("Verticle", Line.StartPoint.Y, Line.StartPoint.X, Line.EndPoint.Y, Line.EndPoint.X)
Return y
ElseIf Line.StartPoint.X <> Line.EndPoint.X And Line.StartPoint.Y <> Line.EndPoint.Y Then
'MsgBox("Line is neither horizontal or verticle, " & Line.StartPoint.Y & vbCrLf & "Verticle, " & Line.EndPoint.Y,, "HorizontalVerticle Function")
Dim y = New Tuple(Of String, Double, Double, Double, Double)("Angled", Line.StartPoint.Y, Line.StartPoint.X, Line.EndPoint.Y, Line.EndPoint.X)
Return y
End If
End Function