[SOLVED] heading vector problem

Started by
4 comments, last by KxL 17 years, 2 months ago
Hi, its hard to describe my problem without a image, so please take a look at this: http://www.users.pjwstk.edu.pl/~s2562/problem.jpg P,P1, and O are points in 3d, but they all are in one plane (for all of them Y value are 0), so we could think about them as 2d points. V is a vector (same as points, showing 2d direction). My aim is to find angle by which I have to rotate heading vector to aim at P1 point. Rotation orgin is O. Is it possible to do it with this 4 parameters (P,O,P1,V)? If I knew P` or V` i could count angle. Thanks for any help. Krystian [Edited by - KxL on January 26, 2007 2:47:52 PM]
Advertisement
It should be possible.

Everything is better with Metal.

you know alpha, which the angle between vector |OP| and V.
you know |OP'| (the radius of turn).
you know |OP1|.

Everything is better with Metal.

I was going to suggest that you find the intersection of the direction ray with a circle centered at O with radius |OP1|. Call that point Q. Then the rotation is just the angle between OQ and OP1. You can determine angle and rotation direction with a dot/cross product pair.

I too made a pretty picture (just modified your original one):

that's better actually :) It can be done with vector maths.

Everything is better with Metal.

Thank you all!

Zipster, your solution is greate. I do my own calculations, and my solution was:
http://www.users.pjwstk.edu.pl/~s2562/odp.jpg

as you can see, I haven't notice, that my angle is QOP1, and draw another circle, and do circle-cirlce intersection to find P' Your solution is much more clever.

Best regards,
Krystian

This topic is closed to new replies.

Advertisement