[英]Controlable bezier curve controler in pyqtgraph
I want to construct a plot item with a controlable bezier curve (using 4 points) 我想构造一个具有可控贝塞尔曲线的绘图项(使用4个点)
c3 = -P1 + 3 * (P2 - P3) + P4
c2 = 3 * (P1 - (2 * P2) + P3)
c1 = 3 * (P2 - P1)
c0 = P1
curve = ((c3 * time_points + c2) * time_points + c1) * time_points + c0
I would like something that look like this: 我想要看起来像这样的东西:
My question is, what would be the most straightforward way of implementing this in pyqtgraph. 我的问题是,在pyqtgraph中实现此目的最直接的方法是什么。 I see two ways:
我看到两种方式:
Thanks for any insight on this ! 感谢您对此的任何见解!
Ok, after some research, I found an example implementation of an bezier ROI using pyqtgraph. 好的,经过一些研究,我发现了使用pyqtgraph实现贝塞尔曲线ROI的示例。 Here is a link to the github repository
这是指向 github仓库的链接
Basically it is about subclassing ROI class, using a freehandle type of handle (which is not relative). 基本上,它是关于使用自由句柄类型的句柄(不是相对的)对ROI类进行子类化。 and painting the bezier curve (by "hand").
并绘制贝塞尔曲线(通过“手工”绘制)。
There is also the qt toCubic function that draw bezier. 还有绘制贝塞尔曲线的qt toCubic函数。
Using ROI allows to get all the features of ROI, that I would have to implement from scratch if I had chosen using PlotDataItem. 使用ROI可以获取ROI的所有功能,如果我选择使用PlotDataItem,则必须从头开始实现。 It is still not so obvious, and a good understanding of pyqt seems necessary to get everything in place for the ROI to work as expected.
仍然不是很明显,对pyqt的深入了解似乎是必要的,以便使一切就绪以使ROI正常工作。
I hope this will help others 我希望这会帮助别人
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.