Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw Sine Wave in WPF

Tags:

c#

math

wpf

drawing

This one seems quite stupid, but I'm struglling from an hour to do this,

How to Draw the Sine Wave in WPF??

Thanks

like image 357
Prashant Cholachagudda Avatar asked Jan 24 '23 13:01

Prashant Cholachagudda


1 Answers

Draw lines between points which you calculate with Math.Sin function. You'll have to decide how many points per cycle to use, a compromise between drawing speed and accuracy. Presumably you'll also need to scale the amplitude to suit the area on the screen, since Sin function will return a value between +1 and -1.

like image 162
Martin Avatar answered Jan 30 '23 14:01

Martin