Re: Calculate Angle and Length in Triangle
- From: "Dana DeLouis" <ddelouis@xxxxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 13:36:32 -0500
Here's my best guess using vba.
Returns:
Side: 63.4684673895389
Angle: 31.5230048170743
Sub Demo()
Dim v1, v2, x, y, v
'Vector to x & y
v1 = FromVector(35, 20)
v2 = FromVector(30, 45)
With WorksheetFunction
'Vector Addition
v = .Transpose(.Transpose(Array(v1, v2)))
x = .Sum(.Index(v, 0, 1))
y = .Sum(.Index(v, 0, 2))
Debug.Print " Side: " & Sqr(.SumX2PY2(x, y))
Debug.Print "Angle: " & .Degrees(.Atan2(x, y))
End With
End Sub
Function FromVector(r, th)
'// Angle th in Degrees
Dim A
A = WorksheetFunction.Radians(th)
FromVector = Array(r * Cos(A), r * Sin(A))
End Function
--
HTH :>)
Dana DeLouis
"Dana DeLouis" <ddelouis@xxxxxxxxxxxxx> wrote in message
news:ev6vhZueIHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
Sounds to me like you are doing simple Vector addition.
Just guessing of course, but a Vector (r, Theta) to (x,y,z) might be:
(Change Degrees to Radians, z is zero)
{r*Cos[d*Degree], r*Sin[d*Degree], 0}
Hence:
v1 = Vector[35, 20]
{35*Cos[20*Degree], 35*Sin[20*Degree], 0}
v2 = Vector[30, 45]
{15*Sqrt[2], 15*Sqrt[2], 0}
Add your x,y, & z 's together (z is zero)
The general equation from x,y,z to a Vector (r, Theta,z) is:
{Sqrt[x^2 + y^2], ArcTan[x, y], z}
If I cheat and use a math program...
v3 = CoordinatesFromCartesian[v1 + v2, Cylindrical]
{63.468467389538915, 0.5501802241799797, 0.}
Side: 63.468
Angle: 0.55 Radians
or 31.523 Degrees
{63.468467389538915, 31.52300481707432, 0.}
Again, just guessing.
--
Dana DeLouis
"Cathy" <Cathy@xxxxxxxxxx> wrote in message
news:13sfhova6onje34@xxxxxxxxxxxxxxxxxxxxx
And sometimes too little information....
The angle provided is not the angle of a corner. It is the angle of the
line (or direction the line is pointing in with 0 degrees being at
horizontally pointing up, 90 degrees pointing vertically to the right
etc.)
Regards
C
.
- Follow-Ups:
- Re: Calculate Angle and Length in Triangle
- From: Cathy
- Re: Calculate Angle and Length in Triangle
- References:
- Calculate Angle and Length in Triangle
- From: Cathy
- Re: Calculate Angle and Length in Triangle
- From: Dave Peterson
- Re: Calculate Angle and Length in Triangle
- From: Cathy
- Re: Calculate Angle and Length in Triangle
- From: Dana DeLouis
- Calculate Angle and Length in Triangle
- Prev by Date: Re: Extract letters and numbers from string
- Next by Date: Send mail to multiple recipients
- Previous by thread: Re: Calculate Angle and Length in Triangle
- Next by thread: Re: Calculate Angle and Length in Triangle
- Index(es):