当前位置:网站首页>[Halcon&几何] 直线的垂线与延长线的计算
[Halcon&几何] 直线的垂线与延长线的计算
2022-08-09 10:00:00 【丶布布】
一、直线垂直线的计算
1、函数源码
dev_close_window ()
dev_open_window (0, 0, 400, 400, 'black', WindowHandle)
draw_line (WindowHandle, Row1, Col1, Row2, Col2)
*获取直线角度
gen_region_line (RegionLines2, Row1, Col1, Row2, Col2)
gen_contour_region_xld (RegionLines2, Contours, 'border')
elliptic_axis_points_xld (Contours, Ra3, Rb3, Phi)
*获取直线中点
area_center_points_xld (Contours, Area4, RowCenter, ColCenter)
*垂线长度
LineLength:=200
*起点
RowStart := RowCenter-cos(Phi)*LineLength
ColStart := ColCenter-sin(Phi)*LineLength
*终点
RowEnd := RowCenter+cos(Phi)*LineLength
ColEnd := ColCenter+sin(Phi)*LineLength
gen_region_line (Line1, RowStart, ColStart, RowEnd, ColEnd)
2、计算效果

二、直线延长线的计算
1、函数源码
dev_close_window ()
dev_open_window (0, 0, 700, 700, 'black', WindowHandle)
draw_line (WindowHandle, Row1, Col1, Row2, Col2)
*获取直线角度
gen_region_line (RegionLines2, Row1, Col1, Row2, Col2)
gen_contour_region_xld (RegionLines2, Contours, 'border')
elliptic_axis_points_xld (Contours, Ra3, Rb3, Phi)
*获取直线中点
area_center_points_xld (Contours, Area4, RowCenter, ColCenter)
***********************生成延长线*************************
*延长线长度
LineLength:=1100
*起点
RowStart := RowCenter-cos(Phi+1.5708)*LineLength
ColStart := ColCenter-sin(Phi+1.5708)*LineLength
*终点
RowEnd := RowCenter-cos(Phi-1.5708)*LineLength
ColEnd := ColCenter-sin(Phi-1.5708)*LineLength
gen_region_line (Line2, RowStart, ColStart, RowEnd, ColEnd)
dev_display (Line2)
2、计算效果

注: elliptic_axis_points_xld获取直线的角度较line_orientation和line_position求直线角度而言,计算出的延长线精度会更高,可以自行验证,其他角度计算方法可以参考我的博文:[Halcon] 直线中点、端点和角度的计算
| 戳戳小手帮忙点个免费的赞和关注吧,嘿嘿。 |
边栏推荐
- Multi-threaded cases - timer
- 3D printed this DuPont cable management artifact, and the desktop is no longer messy
- EndNote User Guide
- 借问变量何处存,牧童笑称用指针,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang类型指针(Pointer)的使用EP05
- 多线程案例——定时器
- Openwrt配置Aria2(Hg255d)
- MySQL约束关系,你必须要知道的知识点!
- 条件控制语句
- 5.Set interface and implementation class
- A Practical Guide to Building OWL Ontologies using Protege4 and CO-ODE Tools - Version 1.3 (7.4 Annotation Properties - Annotation Properties)
猜你喜欢
![[Machine Learning] Detailed explanation of web crawler combat](/img/ac/f00f0c81e66ba526ac39ee60fad72b.png)
[Machine Learning] Detailed explanation of web crawler combat

自定义类型:结构体,枚举,联合

LeetCode147:对链表进行插入排序 画图分析 思路清晰!
Ontology Development Diary 03 - When debugging is in progress

需求侧电力负荷预测(Matlab代码实现)

Quick sort eight sorts (3) 】 【 (dynamic figure deduction Hoare, digging holes, front and rear pointer method)

文件操作

【八大排序①】插入排序(直接插入排序、希尔排序)

Demand side power load forecasting (Matlab code implementation)

OSCS开源软件安全周报,一分钟了解本周开源软件安全大事
随机推荐
BigDecimal用法常用操作记录
KMP& sunday
Browser error classification
收到人生第一笔五位数工资
安装torch_sparse失败解决方法
Source GBase database, oracle quote "ORA - 01000: beyond the shop open the cursor"
mysql 修改密码和忘记密码操作
Super detailed MySQL basic operations
基本运算符
Firebase+Facebook 授权 web 登录提示域名验证或跳转错误
LeetCode147:对链表进行插入排序 画图分析 思路清晰!
tuple dictionary collection
写一个通讯录小程序
条件控制语句
五个不同事物隔离级别,七个事物传播行为
在anaconda环境中配置cuda和cudnn
8. Recursively traverse and delete cases
动态内存管理
Attentional Feature Fusion
[Machine Learning] Basics of Data Science - Basic Practice of Machine Learning (2)