title: C# clock not working cause there is no negative coordinates in wpf
body: <p>I'm trying to make a simple clock and it isn't working because sin and cos give negative values which wpf doesnt have!</p>
  
  <pre><code>namespace Desenho
  {
      /// &lt;summary&gt;
      /// Interaction logic for MainWindow.xaml
      /// &lt;/summary&gt;
      public partial class MainWindow : Window
      {
          [DllImport("Kernel32")]
          public static extern void AllocConsole();
  
      [DllImport("Kernel32")]
      public static extern void FreeConsole();
  
      private Timer timer1;
      int i = 0;
  
      public MainWindow()
      {
          InitializeComponent();
          AllocConsole();
          Console.Clear();
          InitTimer();
  
      }
  
      public void InitTimer()
      {
          timer1 = new Timer();
          timer1.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Tick);
          timer1.Interval = 1; // in miliseconds
          timer1.Start();
          /*for(int a = 0; a&gt;-200; a--)
          {
              Console.WriteLine("Angulo: {0}; Cos: {1}; Sen: {2}; Rad: {3};", a, Math.Cos(toRad(a)), Math.Sin(toRad(a)), toRad(a));
          }*/
      }
  
      private void timer1_Tick(object sender, EventArgs e)
      {
          /*if(i == 5)
          {
              i = 0;
          }
          mudaCores(i);
          i++;*/
          float x = 100+(float)Math.Cos(toRad(i));
          float y = 100+(float)Math.Sin(toRad(i));
          desenhaLinha(x, y);
          i--;
          Console.WriteLine("Angulo: {0}; X: {1}; Y: {2};", i, x, y);
      }
  
      private async void desenhaLinha(float x, float y)
      {
  
              await Task.Run(() =&gt;
              {
                      panel.Dispatcher.BeginInvoke((Action)(() =&gt; panel.linhas.Add(new Cordenadas(new Pen(new SolidColorBrush(Colors.Red), 2), new Point(100, 100), new Point(x, y)))));
                      panel.Dispatcher.BeginInvoke((Action)(() =&gt; panel.InvalidateVisual()));
  
              });
  
          }
  
  
  
      private async void mudaCores(int i)
      {
          Color[] cores = new Color[] { Colors.Red, Colors.Black, Colors.Blue, Colors.Green, Colors.Yellow, Colors.Violet };
          try
          {
              await Task.Run(() =&gt; { panel.Dispatcher.BeginInvoke((Action)(() =&gt; panel.color = cores[i]));
                  panel.Dispatcher.BeginInvoke((Action)(() =&gt; panel.InvalidateVisual()));
              });
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
      }
  
      double toRad(double graus)
      {
          double rad;
          rad = graus * Math.PI / 180;
          return rad;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My drawLine func only takes one point as argument cause it assumes the center one as 100, 100. How can i make this work?</p>