vector math

Hello everyone,
I have a little problem in vector math.
I want to convert a 3D direction vector into a 2D vector, but I don’t know how.
so you have 2 vectors to calculate the direction and one plane normal vector.
How to proceed?

thanks in advance!

EDIT: 2 images to visualize what I want:
so, I have something like this:

and want to get something like this:

I don’t understand your question…

“a 3D direction vector into a 2D vector”
You can’t do that without losing information about 1 dimension, obviously…

“2 vectors to calculate the direction and one plane normal vector”
Is this what you start with, or what you want to end up with? And you were talking about a direction vector, and now you have a surface normal…

please read correctly and full sentences, I wrote that I have those values of those 3 vectors and I want to get the vector direction resulting from the 2 vectors to a 2D direction vector.

I know how to get the normalized direction vector out of the 2 3D vectors, but I don’t know how to project the normalized direction vector on to a 2D plane in relation with the normal vector of the 3D plane

Every time I read it, it makes even less sense to me. Try google translate :retard:

and you can’t see the images?
I want the direction of the 3D vector but without the Z vector, but I can’t just set z = 0 because the plane normal is not alway (0;0;1) (x;y;z)

Ahhh, just checked the images you added.

So basically you want to project a 3D vector onto 2 other vectors (which are still 3D vectors, but they’re both on the same plane)

https://en.wikipedia.org/wiki/Dot_product
https://en.wikipedia.org/wiki/Scalar_resolute

If vector A is the vector to project, and vector B is the vector representing the X axis on your plane:
A dot B = ||A|| * ||B|| * cos(theta) , where theta is the angle between the two vectors
As shown here, you need ||A||*cos(theta)

So if you do:
(A dot B ) / ||B|| (note that if B is a unit vector, you don’t even need to divide here)
it gives you the length of A, in the direction of B.

Converting a vector V to a (X,Y) coordinate on your plane if X and Y are two unit vectors:
( (V dot X) ; (V dot Y) )

You might need to invert V, depending on what you want…

Test example with an orthogonal system: the plane’s normal is (0,0,1)
the plane’s X,Y axis vectors are (1,0,0) and (0,1,0)
The coordinate is (3,4,5)… the vector is either (3,4,5) or (-3,-4,-5), depending on which end you want the origin to be.

V dot X = (3,4,5) Dot (1,0,0) = 3
V dot Y = (3,4,5) Dot (0,1,0) = 4
(X,Y) = 3,4
Which, in this case, is just like just removing the z coordinate, so it seems to work.

yeah, that looks right, thanks!

As an interesting side note, I’m currently taking 3-dimensional force vectors in my General Engineering class in university. Projecting vectors onto a 2D plane is useful for analyzing forces in 3D space on a 2D plane while maintaining their magnitude / length relative to the plane itself, breaking the force into its components along each of the 3 axis.

Kinda interesting stuff if you’re into that kind of thing.

hm, sudpuzzer, that’s pretty much what I try to achieve

indeed… just like you break up 2D forces in 2 components and treat them individually.

2L;DR-Did he meant “How to determine a projection of 3D-vector on 2D-space?”

Oh! srry he got his answer :smiley:

Founded in 2004, Leakfree.org became one of the first online communities dedicated to Valve’s Source engine development. It is more famously known for the formation of Black Mesa: Source under the 'Leakfree Modification Team' handle in September 2004.