c# Moving from point A to point B in 3d space

Hello,


I am trying to move from point A(X1,Y1,Z1) to point B(X2,Y2,Z2) and calculate heading as well.
Move from point to point will be done incremental ... i will calculate distance between point in 3d space
and if distance in greater than let say 200 i will move in 2 steps (i hope i have explained it good).

I am coding in c# ... can someone post a function or a code snipped how could this be done in most efficient way?

Thnak you!
TagyourareitAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
The distance between A and B would be sqrt((X1-X2)^2+(Y1-Y2)^2+(Z1-Z2)^2)
to move in 2 steps, the first step would be to point C((X1+X2)/2,(Y1+Y2)/2,(Z1+Z2)/2)
0
TagyourareitAuthor Commented:
Hello,

thank you for fast replay.

And  what about heading direction? How can i calculate that?
0
ozoCommented:
If you are specifying heading as a unit vector, that would be  (X2-X1)/distance,(Y2-Y1)/distance,(Z2-Z1)/distance
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TagyourareitAuthor Commented:
I mean as a move direction (which way you are facing at when traveling from one point to another) in degrees.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Algorithms

From novice to tech pro — start learning today.