SHARE
TWEET

Untitled

a guest Dec 13th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  public void drawTriangle(PointF a, PointF b, PointF c, int iter)
  2.         {
  3.             if (iter == 0)
  4.                 return;
  5.             PointF m = new PointF();
  6.             PointF ab = new PointF();
  7.             PointF ac = new PointF();
  8.             ab.X = b.X - a.X;
  9.             ab.Y = b.Y - a.Y;
  10.             ac.X = c.X - a.X;
  11.             ac.Y = c.Y - a.Y;
  12.             m.X = a.X + (ab.X + ac.X) / 3;
  13.             m.Y = a.Y + (ab.Y + ac.Y) / 3;
  14.             graph.DrawLine(pen, a.X, a.Y, m.X, m.Y);
  15.             graph.DrawLine(pen, b.X, b.Y, m.X, m.Y);
  16.             graph.DrawLine(pen, c.X, c.Y, m.X, m.Y);
  17.             drawTriangle(a, b, m, iter - 1);
  18.             drawTriangle(b, c, m, iter - 1);
  19.             drawTriangle(a, c, m, iter - 1);
  20.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top