halcon拓展系列—计算任意矩形的四个角点坐标算子
* ****************************************
* * 求rectangle2的四个直角点
* * 0********|*********2
* * *********|**********
* * *********|**********
* * *********|**********
* * *********|**********
* * *********|**********
* * 1********|*********3
* *注:以与水平方向所成角度较大的边中线为轴线
* ****************************************
pi := acos(0)*2
if (phi >= 0 and phi < pi/4)
phi := phi - pi/2
Tem := length1
length1 := length2
length2 := Tem
elseif (phi > -pi/4 and phi < 0)
phi := phi + pi/2
Tem := length1
length1 := length2
length2 := Tem
endif
*
if (phi >= 0)
la := phi ///63
lb := la - pi/2 -26
tuple_tan (la, tem1)
tuple_tan (lb, tem2)
tuple_sqrt ((length1 * length1) / (1 + tem1 * tem1), xLength1)
tuple_sqrt ((length2 * length2) / (1 + tem2 * tem2), xLength2)
tuple_sqrt ((tem1*tem1*length1*length1) / (1 + tem1 * tem1), yLength1)
tuple_sqrt ((tem2 * tem2 * length2 * length2) / (1 + tem2 * tem2), yLength2)
* 左上
gen_cross_contour_xld (Cross, 1, columnCenter + xLength1- xLength2, 6, 0.785398)
mColumnUpLeft := columnCenter + xLength1 - xLength2
nRowUpLeft := rowCenter - yLength1 - yLength2
* 左下
mColumnDownLeft := columnCenter - xLength1 - xLength2
nRowDownLeft := rowCenter + yLength1 - yLength2
* 右上
mColumnUpRight := columnCenter + xLength1 + xLength2
nRowUpRight := rowCenter - yLength1 + yLength2
* 右下
mColumnDownRight := columnCenter - xLength1 + xLength2
nRowDownRight := rowCenter + yLength1 + yLength2
else
la := phi
lb := la - pi/2
tuple_tan (la, tem1)
tuple_tan (lb, tem2)
tuple_sqrt ((length1 * length1) / (1 + tem1 * tem1), xLength1)
tuple_sqrt ((length2 * length2) / (1 + tem2 * tem2), xLength2)
tuple_sqrt ((tem1*tem1*length1*length1) / (1 + tem1 * tem1), yLength1)
tuple_sqrt ((tem2 * tem2 * length2 * length2) / (1 + tem2 * tem2), yLength2)
* 左上
mColumnUpLeft := columnCenter - xLength1 - xLength2
nRowUpLeft := rowCenter - yLength1 + yLength2
* disp_cross (3600, nRowUpLeft, mColumnUpLeft, 16, 0)
* 左下
mColumnDownLeft := columnCenter + xLength1 - xLength2
nRowDownLeft := rowCenter + yLength1 + yLength2
* disp_cross (3600, nRowDownLeft, mColumnDownLeft, 16, 0)
* 右上
mColumnUpRight := columnCenter - xLength1 + xLength2
nRowUpRight := rowCenter - yLength1 - yLength2
* 右下
mColumnDownRight := columnCenter + xLength1 + xLength2
nRowDownRight := rowCenter + yLength1 - yLength2
endif
row := []
column := []
row[0] := nRowUpLeft
column[0] := mColumnUpLeft
row[1] := nRowDownLeft
column[1] := mColumnDownLeft
row[2] := nRowUpRight
column[2] := mColumnUpRight
row[3] := nRowDownRight
column[3] := mColumnDownRight
return ()
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律