简体   繁体   中英

Bezier curve fitting to data with python

I know there has been a lot of topics about curve fitting here but I have not found anything that would suite my needs.

I'm trying to make a simple sail analysis app with python. The code "calculates" sail shape stripe and calculates some data from it but I cannot get the correct "entry angle" and "exit angle" as they are defined by the curve control points.

See ref image:

So my existing data is in form of x,y points and i would like to fit bezier curve to the existing data so I could calculate the entry and exit angles. I might also be possible to fit b-spline to the existing data but either way it should be so that the "mid point" and points next to it either side has same y-value.

This question (of fitting Bezier in Python) may have already been answered:

Bézier curve fitting with SciPy

Pomax makes a good point; for curve fitting, a simple y=f(x) relation (polynomial, for example) would probably do the job; see numpy polyfit, unless there is a specific reason you need a Bezier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM