Finding remaining 4 points of Cuboid

3dcomputational geometryrectanglesvectors

Starting with points $P_1, P_2, P_4, P_5$ of a Cuboid from the graphic seen in this Question:

Check if a point is inside a rectangular shaped area (3D)?

How do I find the remaining points $P_3, P_6, P_7, P_8,$ assuming the Cuboid can be in any orientation (not axis aligned).

I have been able to find $P_6$ by adding direction and magnitude of $P_5$ from $P_1$ to $P_2$: $$P_6 = P_2 + \lvert P_5 – P_1\rvert \times \|P_5 – P_1\|$$

Is there a less complex solution? Possibly one that avoids square roots?

Best Answer

Note that the sides are parallel. So $$P_3-P_4=P_2-P_1$$ Move $P_4$ to the other side: $$P_3=P_4+(P_2-P_1)$$ Similarly, $$P_6=P_5+(P_2-P_1)\\P_8=P_5+(P_4-P_1)$$ For $P_7$ you need to start from one of these last three computed points. For example $$P_7=P_8+(P_2-P_1)$$

Related Question