HALCON 计算两点连线的角度的自定义算子

*get 2_point connected line angle
x:= x2-x1
y:= y2-y1

tuple_pow(x, 2, Powx)
tuple_pow(y, 2, Powy)

tuple_sqrt(Powy+Powx, hypotenuse)
icos := x/hypotenuse
tuple_acos (icos, radian)
iangle := 180/(3.1415926/radian)

if(y<0)
    iangle := -iangle
elseif(y == 0 and x<0)
    iangle := 180
endif

Angle := iangle
return ()

输入x1,x2,y1,y2

输出 Angle


参考:https://zhidao.baidu.com/question/1962294880087296700.html

猜你喜欢

转载自blog.csdn.net/u012388993/article/details/79881999