快速公式来找出其他三个正方形的第四顶点的坐标 [英] Fast formula to find the coordinate of the 4th vertex of the square by three others
问题描述
坐标系统上可能有4个数字。
There are 4 possible figures on the coordinate system.
XO
XX
OX
XX
XX
OX
XX
XO
这是一种正方形,每个X或O的尺寸均为1x1。
It is kind of square, each X or O have dimensions of 1x1.
最快的查找方法是什么如果您在该图中具有XXX的坐标(X1,Y1),(X2,Y2),(X3,Y3),那么坐标(Xo,Yo)?
What's the fastest way to find the coordinates (Xo, Yo) if you have coordinates (X1, Y1), (X2, Y2), (X3, Y3) of XXX in that figure?
推荐答案
它是(x1 ^ x2 ^ x3,y1 ^ y2 ^ y3)
。对于x和y,您有两个相同的坐标,而另一个则不同。将它们异或会导致一对相同的坐标取消。
It's (x1 ^ x2 ^ x3, y1 ^ y2 ^ y3)
. For each of x and y, you've got two coordinates the same, and a different one. Xor'ing them together causes the pair of coordinates that are the same to cancel. This works whatever units you're using for the square.
例如:给出(10,20),(50,30),( 10,30)
得到(10 ^ 50 ^ 10,20 ^ 30 ^ 30)
就是(50, 20)
。
这篇关于快速公式来找出其他三个正方形的第四顶点的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!