How to define rectangle with two points in 3D?

Hello!

I’m interested in drawing a rectangle in 3D space if I know two vertices (A & D). Is there any formula to find other two vertices (B & C)?

A—B
|;;;|
C—D

Thanks in advance!

No, because there are infinitely many rectangles that exist in 3-space with vertices at A and D. Your problem is underdefined.

david_f_knight is right. You need some additional constraint. For A & D you can have a rectangle fit at the corners but rotate on that pivot to face any direction. If you add the constraint that the rectangle has to face a given direction–say the viewer–than it is possible.

That alone would not be sufficient to specify a unique rectangle.

If you take the sphere whose diameter is the line AD, then every pair of diametral points B, C on the sphere define a rectangle (by Thales’ Theorem).

If you restrict the rectangle to a fixed plane, you can still pick an arbitrary point from the circle that is the intersection of the plane and the sphere.

But you would get exactly one square with these constraints.

Yeah, true that, mbentrup. I guess, I just assume any rectangle worth looking at is aligned with the screen. :frowning:

Define it as an OBB, or AABB if it is axis-oriented.