Find perpendicular coordinates in 3D space using two 3D points

66 Views Asked by At

Let's suppose I have a six by six cube each with xyz coordinates.

Moving from the middle cube (0,0,0) to the other sides (let's say (0,1,0), I would like to find the other 4 components that are peperdicular to the middle cube following the direction of (0,1,0).

If we move one dimension, this is easy (and my brain can grasp it)... the components will be (-1,0,0),(+1,0,0), (0,0,+1), (0,0,-1).

Now, could somebody help me with moving to size where two (to (1,1,0) or three coordinates change (1,1,-1)?

Thanks, Rodrigo

2

There are 2 best solutions below

1
On BEST ANSWER

Thank you, this is exactly what I did.

Here is my solution:

(in matlab) I created a number of all possibility unit values:

pos_vals=[ 0 0 0 ; -1 0 0 ; 1 0 0 ; 0 1 0 ; 0 -1 0 ; -1 -1 0 ; 1 1 0 ; -1 1 0 ; 1 -1 0; 0 0 1 ; -1 0 1 ; 1 0 1 ; 0 1 1 ; 0 -1 1 ; -1 -1 1 ; 1 1 1 ; -1 1 1 ; 1 -1 1 ; 0 0 -1 ; -1 0 -1 ; 1 0 -1 ; 0 1 -1 ; 0 -1 -1 ; -1 -1 -1 ; 1 1 -1 ; -1 1 -1 ; 1 -1 -1];

And then based on my reference coordinate [eg vec_ofinterest=(1,1,0) ] , I do the following:

for idx_posvals=1:size(pos_vals,1) gg(idx_posvals)=dot(vec_ofinterest,pos_vals(idx_posvals,:)); if gg(idx_posvals) == 0 pos_vals(idx_posvals,:) end end

Which give me 8 solutions (including the reciprocals you mentioned). -1 1 0 1 -1 0 0 0 1 -1 1 1 1 -1 1 0 0 -1 -1 1 -1 1 -1 -1

It looks like this is solved. In case somebody find and error, please let me know. Rodrigo

0
On

There is infinity number of perpendicular vectors in 3D space.

If you want to restrict their components by values 0, +-1, then consider the next approach:

Your vector components are A=(ax, ay, az). Dot product of perpendicular vector B=(bx, by, bz) with A must be zero

ax * bx + ay * by + az * bz = 0

To form components of B:

get A components
nullify arbitrary component (if one of other components is not zero)
exchange two another components
negating one of them

example:

(bx, by, bz) = (0, -az, ay)

So for vector A=(1,1,-1) one of six perpendiculars is B1=(0, 1, 1)

For vector A=(1,1,0) there are four variants with given restrictions:

 (-1, 1, 0)
 (1, -1, 0)
 (0, 0, 1)
 (0, 0, -1)

If you want to fix a pair components of perp. vector - just substitute needed values in dot product formula and solve for unknown component of B