Hello,

that should give you the coordinates of D.

As to know whether it's a rectangle or not... you should know that a rectangle is a parallelogram with a right angle.

So check if the scalar product between and is 0.

Memo : x_a,y_a,z_a) \text{ and } Bx_b,y_b,z_d) \quad \Rightarrow \quad \vec{AB}x_b-x_a,y_b-y_a,z_b-z_a)" alt="Ax_a,y_a,z_a) \text{ and } Bx_b,y_b,z_d) \quad \Rightarrow \quad \vec{AB}x_b-x_a,y_b-y_a,z_b-z_a)" />

(coordinates of vector)