Tommy

08-11-2017, 05:30 AM

Hi All,

I am having some issues with figuring angles between 2 lines.

2005620057

Above are 2 images of where I am trying to find the angle. The first I get 5 degrees, the second one I get 60 degrees. They should be 85 degrees and 120 degrees. I am using this formula:

Slope_A = (iData(iOne).Y - iData(iOne).y1) / (iData(iOne).X - iData(iOne).x1)

Slope_B = (iData(iOne + 1).Y - iData(iOne + 1).y1) / (iData(iOne + 1).X - iData(iOne + 1).x1)

Tangent_of_Angle = (Slope_B - Slope_A) / (1 + Slope_A * Slope_B)

Here is the iData class:

Public Class TLine

Public X As Double

Public Y As Double

Public x1 As Double

Public y1 As Double

Public tLength As Double

Public Property LineLength() As Double

Get

Return SettLength()

End Get

Set(ByVal value As Double)

tLength = value

End Set

End Property

Private Function SettLength()

If X = x1 Then 'line is straight

tLength = Math.Abs(Y - y1)

ElseIf Y = y1 Then 'line is straight

tLength = Math.Abs(X - x1)

Else

tLength = Math.Sqrt(Squared(Math.Abs(X - x1)) + Squared(Math.Abs(Y - y1)))

End If

SettLength = tLength

End Function

End Class

I will post whatever information you need to help.

The data is coming from a drawing that is to scale so the data is correct.

Thanks for looking.

Any help at all is appreciated.

I am having some issues with figuring angles between 2 lines.

2005620057

Above are 2 images of where I am trying to find the angle. The first I get 5 degrees, the second one I get 60 degrees. They should be 85 degrees and 120 degrees. I am using this formula:

Slope_A = (iData(iOne).Y - iData(iOne).y1) / (iData(iOne).X - iData(iOne).x1)

Slope_B = (iData(iOne + 1).Y - iData(iOne + 1).y1) / (iData(iOne + 1).X - iData(iOne + 1).x1)

Tangent_of_Angle = (Slope_B - Slope_A) / (1 + Slope_A * Slope_B)

Here is the iData class:

Public Class TLine

Public X As Double

Public Y As Double

Public x1 As Double

Public y1 As Double

Public tLength As Double

Public Property LineLength() As Double

Get

Return SettLength()

End Get

Set(ByVal value As Double)

tLength = value

End Set

End Property

Private Function SettLength()

If X = x1 Then 'line is straight

tLength = Math.Abs(Y - y1)

ElseIf Y = y1 Then 'line is straight

tLength = Math.Abs(X - x1)

Else

tLength = Math.Sqrt(Squared(Math.Abs(X - x1)) + Squared(Math.Abs(Y - y1)))

End If

SettLength = tLength

End Function

End Class

I will post whatever information you need to help.

The data is coming from a drawing that is to scale so the data is correct.

Thanks for looking.

Any help at all is appreciated.