Skip to content

Commit

Permalink
Eliptical branches
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpi committed Dec 26, 2020
1 parent 3ff962d commit b0e18a9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion FractalTrees/Tree.fs
Expand Up @@ -18,8 +18,17 @@ let drawTree file =
let x = length * Math.Sin(direction)
let y = length * Math.Cos(direction)
let nextX, nextY = startX + x, startY + y
let width = length / 15.
let widthX = width * Math.Cos(direction)
let widthY = width * Math.Sin(direction)

let points =
[| new Point(int (startX - widthX), int (startY - widthY));
new Point(int (nextX - widthX), int (nextY - widthY));
new Point(int (nextX + widthX), int (nextY + widthY));
new Point(int (startX + widthX), int (startY + widthY)) |]
let pen = new Pen(Color.Black, float32 length / 15.f)
g.DrawLine(pen, int startX, int startY, int nextX, int nextY)
g.FillClosedCurve(new SolidBrush(Color.Black), points)
(nextX, nextY)

let largeAngle = Math.PI / 2.4
Expand Down

0 comments on commit b0e18a9

Please sign in to comment.