Halcon 曲线拟合(NURBS 非均匀有理B样条曲线)

Halcon 曲线拟合(NURBS 非均匀有理B样条曲线)_第1张图片
Halcon 曲线拟合(NURBS 非均匀有理B样条曲线)_第2张图片

Halcon 曲线拟合(NURBS 非均匀有理B样条曲线)

1.根据坐标点拟合曲线


* 根据点坐标拟合, NURBS曲线

dev_close_window ()
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)

*** 1.虚拟坐标点拟合曲线 **********************************
* 虚拟坐标点
Rows := [150,160,130,140,180.5, 190]
Cols := [50, 150,200,300,400.5, 450]

* 绘制坐标点 位置
gen_cross_contour_xld (Cross, Rows, Cols, 12, 0.785398)
* 拟合曲线  [0,-10,0,10] 起点与终点切线
gen_nurbs_interp (Rows, Cols, [0,-10,0,10], 3, CtrlRows, CtrlCols, Knots)
* 生成曲线XLD
gen_contour_nurbs_xld (Contour, CtrlRows, CtrlCols, Knots, 'auto', 3, 1, 5)

* 显示结果
dev_display (Contour)
dev_display (Cross)
stop()

*** 2.自定义坐标拟合曲线 **********************************
RowsSelf := [194.0, 195.0, 196.0, 197.0, 198.0, 199.0, 200.0, 201.0, 202.0, 203.0, 204.0, 205.0, 206.0, 207.0, 208.0, 209.0, 210.0, 211.0, 212.0, 213.0, 214.0, 215.0, 216.0, 217.0, 218.0, 219.0, 220.0, 221.0, 222.0, 223.0, 224.0, 225.0, 226.0, 227.0, 228.0, 229.0, 230.0, 231.0, 232.0, 233.0, 234.0, 235.0, 236.0, 237.0, 237.0, 238.0, 238.0, 238.0, 239.0, 240.0, 241.0, 242.0, 243.0, 244.0, 245.0, 246.0, 247.0, 248.0, 249.0, 250.0, 251.0, 252.0, 253.0, 254.0, 255.0, 256.0, 257.0, 258.0, 259.0, 260.0, 261.0, 262.0, 263.0, 264.0, 265.0, 266.0, 267.0, 268.0, 269.0, 270.0]
ColsSelf := [396.0, 396.0, 396.0, 396.0, 395.0, 395.0, 395.0, 395.0, 394.0, 393.0, 393.0, 392.0, 392.0, 391.0, 390.0, 389.0, 388.0, 388.0, 389.0, 389.0, 389.0, 389.0, 389.0, 389.0, 389.0, 389.0, 389.0, 389.0, 388.0, 388.0, 388.0, 387.0, 387.0, 387.0, 386.0, 385.0, 385.0, 384.0, 383.0, 382.0, 382.0, 383.0, 384.0, 385.0, 386.0, 387.0, 388.0, 389.0, 390.0, 391.0, 392.0, 393.0, 394.0, 395.0, 396.0, 396.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 397.0, 398.0, 398.0, 398.0, 399.0, 399.0, 399.0, 399.0]


* 拟合曲线 [0, 0, 0, 0] 起点与终点切线
gen_nurbs_interp (RowsSelf, ColsSelf, [0, 0, 0, 0], 3, CtrlRows, CtrlCols, Knots)

* 生成曲线XLD
gen_contour_nurbs_xld (ContourSelf, CtrlRows, CtrlCols, Knots, 'auto', 3, 1, 5)

* 绘制坐标点
gen_cross_contour_xld (CrossSelf, RowsSelf, ColsSelf, 2, 0.785398)
* 显示结果
dev_clear_window ()
dev_display (ContourSelf)
dev_display (CrossSelf)

你可能感兴趣的:(Halcon,Halcon)