Center of a 4 point square

79 Views Asked by At

Hello I have 4 3D points in a square, I would like to calculate the center of the square.

[https://i.stack.imgur.com/zQ9wg.png][1]

this is very easy I know, I know, but it's been a while and I simply can't wrap my head around it

I am looking for a formula on how to find point E e.g. the center of this square. I've also provided a quick illustration

Thanks

4

There are 4 best solutions below

3
On BEST ANSWER

First determine (unless this was already specified) which order the points are in in the square. (That is, in the right triangle formed by the threee given points, which point has the right angle.)

The way to do this is that if $C$ is the right angle point, then the dot product of $C-A$ with $C-B$ will be zero. I assume calculating a dot product is easy for you.

Second: Now that we know which point is the girth angle (say point $C$), Then the center of the square is at $$ C+(A-C)/2 + (B-C)/2 $$

Remember, this is to be done as vector addtions and divisions by 2.

Example:

$$ A = (3,0,4)\\B = (2,5,7) \\ C = (1,2,3)$$

We notice that $$(C-A) \cdot (C-B) = (-2,2,-1)\cdot (-1,-3,-4)=2-6+4=0$$ so $C$ is our corner among these three points.

Then the center is at $$P = (1,2,3) + \frac12 (2,-2,1) + \frac12 (1,3,4) = (\frac52,\frac52,\frac{11}{2})$$

0
On

$\vec A + \frac{1}{2} \vec {AC} = \vec {E}$

$\vec {AC} = \vec {OC} - \vec {OA} = \begin{bmatrix}{} 3 \\ 0 \\ 4 \end{bmatrix} - \begin{bmatrix}{} 2 \\ 0 \\ 5 \end{bmatrix} = \begin{bmatrix}{} 1 \\ 0 \\ -1 \end{bmatrix} $

Subbing in from first equation: $ \vec E = \begin{bmatrix}{} 3 \\ 0 \\ 4 \end{bmatrix} + \dfrac{1}{2} \begin{bmatrix}{} 1 \\ 0 \\ -1 \end{bmatrix} = \begin{bmatrix}{} 2 \frac{1}{2} \\ 0 \\ 4 \frac{1}{2} \end{bmatrix} $

Intuitively, because $y=0$ for all points, and between points $A$ and $C$, $x$ increases from 2 to 3 and $y$ decreases from 5 to 4, so you can just take the average and get the same result...

1
On

Add up all the points and divide by $4$. Nothing could be easier.

0
On

Note that the center, $E$, is the midpoint of $A$ and $C$.

Also note that $E$ is the midpoint of $B$ and $D$.

Ergo $\displaystyle E=\frac{A+C}{2}=\frac{B+D}{2}=\left(\frac{5}{2},0,\frac{9}{2}\right)$