# Thread: Find a vector3 that is perpendicular to another vector3 and (0,1,0)?

1. ## Find a vector3 that is perpendicular to another vector3 and (0,1,0)?

Hi everyone,
recently I was trying to solve this problem:

If I know 3D position vectors P0 and P1 how would I go about solving for P2 and P3?
I assumed it would be by taking the cross product of the vector P1 - P0 with an arbitrary basis vector like (0,1,0)
something like

Vector3 perpendicularVector = Vector3.Cross((P1-P0), Vector3.Up);

but I wasn't able to make that work.

Any help on why my understanding is flawed and what I need to study to be able to understand a problem like this would be greatly appreciated!

2. ## Re: Find a vector3 that is perpendicular to another vector3 and (0,1,0)?

Originally Posted by winterkewl
Hi everyone,
recently I was trying to solve this problem:

If I know 3D position vectors P0 and P1 how would I go about solving for P2 and P3?
I assumed it would be by taking the cross product of the vector P1 - P0 with an arbitrary basis vector like (0,1,0)
something like
Vector3 perpendicularVector = Vector3.Cross((P1-P0), Vector3.Up);
I don't really understand what is going on here.
But $\overrightarrow {{P_0}{P_1}} = \left\langle {1,1,0} \right\rangle$

There is no unique answer to this $\overrightarrow {{P_0}{P_2}} = \left\langle {a,b,c} \right\rangle$ where $a+b=0$ and $c$ can be any real.
If that is true then $\overrightarrow {{P_0}{P_1}} \bot \overrightarrow {{P_0}{P_2}}$.

3. ## Re: Find a vector3 that is perpendicular to another vector3 and (0,1,0)?

Hi Plato,

Thanks for your answer! I was pretty sure I was going about this problem the incorrect way...curse my art degree!

Maybe I can clarify what I'm attempting and you can tell me the proper way to go about solving a problem like this.
Say a user can draw a line by choosing a starting location on a 2d grid and an ending location on that same 2d grid.
I'd like to have that action result in the pictured rectangle and not just the 2 points that the user provided.
Does that make any more sense?

of topic: If there is a text that would help me more accurately understand these types of problems that you can recommend I'd love any suggested readings!
Thanks!

4. ## Re: Find a vector3 that is perpendicular to another vector3 and (0,1,0)?

Originally Posted by winterkewl
Say a user can draw a line by choosing a starting location on a 2d grid and an ending location on that same 2d grid.
I'd like to have that action result in the pictured rectangle and not just the 2 points that the user provided.
Does that make any more sense?
Is it 2d grid or 3d grid? If it is a 2d grid, the why did you post 3d example?

5. ## Re: Find a vector3 that is perpendicular to another vector3 and (0,1,0)?

I'm sorry,

I constrained my "clarification example" to 2 dimensions because I thought it would make the explanation easier...
The ultimate solution I was looking for would be in 3 dimensions.

I want to find the corners of a cube with arbitrary length, width, and depth but I only have to 2 positions in 3D space, and the Basis vectors as input.

If that problem is nonsensical (and the more I say it, it sure sounds like it) then I apologize for wasting your time, but appreciate the knowledge.

6. ## Re: Find a vector3 that is perpendicular to another vector3 and (0,1,0)?

Originally Posted by winterkewl
I constrained my "clarification example" to 2 dimensions because I thought it would make the explanation easier... The ultimate solution I was looking for would be in 3 dimensions.
I want to find the corners of a cube with arbitrary length, width, and depth but I only have to 2 positions in 3D space, and the Basis vectors as input. If that problem is nonsensical (and the more I say it, it sure sounds like it) then I apologize for wasting your time, but appreciate the knowledge.
$(0,0,0),~(1,0,0),~(1,1,0),~(0,1,0),~(0,1,1),~(0,0, 1),~(1,0,1),~(1,1.1)$ are the eight vertices of a unit cube.
Its faces parallel to the principal planes.

You need a good deal of mathematics to adjust the lengths of the sides, and to rotate the cube is 3d space.

7. ## Re: Find a vector3 that is perpendicular to another vector3 and (0,1,0)?

Thanks yeah I got that far as well,
made the cube at the origin with the arbitrary lengths then transformed that result to the position P0 and oriented to look at P2,
I just feel like there is a major bit of Vector transformations and indeed Vector's themselves that I'm missing something fundamental here.
Thanks for your help!