# Direction between two vectors on a surface

## Recommended Posts

Hi there. I am currently using graph theory to detect contours in a mesh. It can be done through the intersection lists from the indexed face sets, but I want to set it up so that I can use a heading vector to pick the correct route faster. If you look at the mesh diagram, and look at the bottom red vertex, you can see that it is surrounded by 6 choices for the next move. What I want to do is compare this with the y axis so I can go 'up' in the mesh. The red vertex is the vertex that protudes most in the x axis, and is the tip of the nose of a laser scanned face. So what I want to do now is go up from the vertex, I need to prune the other 5 choices using their angles from the y axis. I know this has something to do with the cross product, but my maths in 3d vectors is rusty, and I was wondering how i use the cross product to compare the two vectors to the y axis, and pick the one that is closest. http://img518.imageshack.us/img518/2643/nodegraphcj0.jpg Cheers! Craig.

##### Share on other sites
You want to find the vector which has the greatest component in the direction of the y-axis amongst the set of vectors starting from bottom red vertex and ending on each of the six neighboring vectors? If this is the case, should it not be enough to compare the dot product of each of these vectors with the y-axis and pick the one with the greatest correlation?

##### Share on other sites
You want to find the vector which has the greatest component in the direction of the y-axis amongst the set of vectors starting from bottom red vertex and ending on each of the six neighboring vectors? If this is the case, should it not be enough to compare the dot product of each of these vectors with the y-axis and pick the one with the greatest correlation?

The surface thing is confusing me. I've done this between two vectors in space, but never on a surface. Basically, i need to travel 'up' on the mesh as much in the y-axis as possible.

I've done this in 2d for a map based routing system.
Get the heading vector by (End - CurrentLocation) then whenever you read a junction, use the angle between the possible route and the heading vector to decide which branch to take, this ensures you are going in approximately the right destination, but i've not done it in 3d before.

##### Share on other sites
I feel I must be missing something. Each move is from one vertex to another, correct? You don't ever stop inbetween vectors? And all the vectors from a vertex to any neighboring vertex will lie on the surface, correct? And the only interesting factor for selection of a vector is the component in the y-axis? Is it not enough to select the vector with the greatest projection on the y-axis?
Calculate:
       vk•yrk = --------      ||vk||

for all vectors vk, k∈N, where y is the normalized y-axis. The vector which produces the greatest r should be the direction you are looking for.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627702
• Total Posts
2978712

• 21
• 14
• 12
• 10
• 12