cas*_*123 31 math geometry formula
我画了一个矩形.我知道它的(x1,y1)左上角和(x2,y2)右下角坐标..我也有绘制矩形的高度h和宽度w.我怎样才能找到中心坐标(x,y)?
我目前正在使用以下公式.
(x,y) = (x2 + x1)/2, (y2+y1)/2
Run Code Online (Sandbox Code Playgroud)
它给出了正确的y坐标,但在x中没有运气.
Pra*_*d G 54
The center of rectangle is the mid point of the diagonal end points of rectangle.
Here the midpoint is ( (x1 +x2)/2 ,(y1 + y2)/2 ).
that means xCenter = (x1 +x2)/2
yCenter = (y1 + y2)/2
Run Code Online (Sandbox Code Playgroud)
让我知道你的代码.
归档时间: |
|
查看次数: |
95766 次 |
最近记录: |