求给解释一下vb的一个式子distance = Int(Sqr((Y - (Shape1(9).Top + Shape1(9).Height \ 2)) ^ 2 + (X - (Shape1(9).Left + Shape1(9).Width \ 2)) ^ 2))这个式子是怎么算的..shape1(9) 是最外面的圈
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/06 19:07:13
![求给解释一下vb的一个式子distance = Int(Sqr((Y - (Shape1(9).Top + Shape1(9).Height \ 2)) ^ 2 + (X - (Shape1(9).Left + Shape1(9).Width \ 2)) ^ 2))这个式子是怎么算的..shape1(9) 是最外面的圈](/uploads/image/z/2693587-67-7.jpg?t=%E6%B1%82%E7%BB%99%E8%A7%A3%E9%87%8A%E4%B8%80%E4%B8%8Bvb%E7%9A%84%E4%B8%80%E4%B8%AA%E5%BC%8F%E5%AD%90distance+%3D+Int%28Sqr%28%28Y+-+%28Shape1%289%29.Top+%2B+Shape1%289%29.Height+%5C+2%29%29+%5E+2+%2B+%28X+-+%28Shape1%289%29.Left+%2B+Shape1%289%29.Width+%5C+2%29%29+%5E+2%29%29%E8%BF%99%E4%B8%AA%E5%BC%8F%E5%AD%90%E6%98%AF%E6%80%8E%E4%B9%88%E7%AE%97%E7%9A%84..shape1%289%29+%E6%98%AF%E6%9C%80%E5%A4%96%E9%9D%A2%E7%9A%84%E5%9C%88)
求给解释一下vb的一个式子distance = Int(Sqr((Y - (Shape1(9).Top + Shape1(9).Height \ 2)) ^ 2 + (X - (Shape1(9).Left + Shape1(9).Width \ 2)) ^ 2))这个式子是怎么算的..shape1(9) 是最外面的圈
求给解释一下vb的一个式子
distance = Int(Sqr((Y - (Shape1(9).Top + Shape1(9).Height \ 2)) ^ 2 + (X - (Shape1(9).Left + Shape1(9).Width \ 2)) ^ 2))这个式子是怎么算的..
shape1(9) 是最外面的圈
求给解释一下vb的一个式子distance = Int(Sqr((Y - (Shape1(9).Top + Shape1(9).Height \ 2)) ^ 2 + (X - (Shape1(9).Left + Shape1(9).Width \ 2)) ^ 2))这个式子是怎么算的..shape1(9) 是最外面的圈
distance是用来计算指定点到最外面圈(以下简称圈9)的圈心的距离
Shape1(9).Height \ 2 是圈9的y半径长度
Shape1(9).Top + Shape1(9).Height \ 2 是指从圈9的最上边的y坐标+圈9的y半径=圈9 x轴所在的y坐标
Shape1(9).Width \ 2 是圈9的x半径长度
Shape1(9).Left + Shape1(9).Width \ 2 是指从圈9的最左边的x坐标+圈9的x半径=圈9 y轴所在的x坐标
因此,Shape1(9).Top + Shape1(9).Height \ 2和Shape1(9).Left + Shape1(9).Width \ 2 将分别表示圈9的中心点y和x坐标,不妨表示为yy和xx,那么原式就变成
distance = Int(Sqr((Y - yy) ^ 2 + (X - xx) ^ 2))
简化后可以看出来,这是两点间的距离公式,表示点(X,Y)到点(xx,yy)之间的距离