15,994,549 members
See more:
I have a straight line in space with an start and end point (x,y,z) and I am attempting to get the angle but I cannot figure out the formula for this. I am using VB.NET

Here is a picture of the line in my 3d environment (the one that is circled in red)

If someone can help, it would be appreciated. Again, i have the values of the start and end points (x,y,z)

It is set to an angle of 70 degrees right now.
Posted
Updated 20-Jan-15 7:53am
v2
Sergey Alexandrovich Kryukov 20-Jan-15 12:43pm
Angle between what and what? If you want to get direction relative to coordinate system, this is not one angle but two.
Just learn a bit of vector algebra; if someone write some code for you, it won't help you. Do I even have to explain why?
—SA

## Solution 2

VB
```Dim x, y, z As Double

x = EndPoint.X - StartPoint.X
y = EndPoint.Y - StartPoint.Y
z = EndPoint.Z - StartPoint.Z

'a = arcsin(v.z / sqrt(v.x²+v.y²+v.z²))
MsgBox((Math.Asin(z / Math.Sqrt((x ^ 2) + (y ^ 2) + (z ^ 2)))) * (180 / Math.PI))```

Is the solution. Someone was kind enough to assist me on another site!

[no name] 20-Jan-15 15:57pm
Then it would be nice for the autrhor of the other site to give a link to it!
Richard MacCutchan 27-Jan-15 11:23am
Well that's clearly mathematics rather than programming.

## Solution 1

That is a mathematical question, nothing to do with VB.NET, or any other language. As far as I recall it has something to do with the length of the sides, and sines, cosines etc.

jk0391 20-Jan-15 12:34pm
Well I'd like to get the proper code to execute the formula which at the same time I am trying to find.
Richard MacCutchan 20-Jan-15 12:45pm
The code is easy once you know the formula. And Google will find that for you.
jk0391 20-Jan-15 12:55pm
Would you be able to help? I've been searching google for hours :(
Richard MacCutchan 20-Jan-15 13:04pm
Seriously? You couldn't work out https://www.google.coM/search?q=calculate+angle?
jk0391 20-Jan-15 13:38pm
It's more complicated than that. You also don't have to be rude.