[Interest] sin wave with QPainterPath between two points
Allan Sandfeld Jensen
kde at carewolf.com
Thu Jul 20 13:46:15 CEST 2017
On Donnerstag, 20. Juli 2017 10:28:17 CEST Elvis Stansvik wrote:
> 2017-07-20 10:23 GMT+02:00 Jean-Michaƫl Celerier
>
> <jeanmichael.celerier at gmail.com>:
> > You can just compute the sine directly :
> > for(int i = 0; i < width; i++)
> > {
> >
> > int x = i;
> > int y = height / 2 + amplitude * std::sin(2 * M_PI * freq * i / width
> > +
> >
> > phase);
> >
> > path.lineTo(x, y);
> >
> > }
>
> I think he wanted to avoid an approximation with straight lines and
> use cubic beziers.
>
If he doesn't do it, Qt will just do it for him based on the bezier curves.
`Allan
More information about the Interest
mailing list