Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let private func_f x = (x + 1.0) * (x + 1.0) / 5.0
- let private func_i x = (x + 1) * (x + 1) / 5
- let private toFloat_0 (n : int) = Convert.ToDouble(n)
- let private toFloat_1 (n : int, f : int) =
- Convert.ToDouble(n) +
- Convert.ToDouble(f) / 10.0
- let private toFloat_2 (n : int, f1 : int, f2 : int) =
- Convert.ToDouble(n) +
- Convert.ToDouble(f1) / 10.0 +
- Convert.ToDouble(f1) / 100.0
- let private toFloat_3 (n : int, f1 : int, f2 : int, f3 : int) =
- Convert.ToDouble(n) +
- Convert.ToDouble(f1) / 10.0 +
- Convert.ToDouble(f1) / 100.0 +
- Convert.ToDouble(f1) / 1000.0
- let private half n = n / 2
- let private DrawBack image =
- let res : Bitmap = image
- let h = image.Height
- let w = image.Width
- for x = 0 to w - 1 do
- res.SetPixel(x, half h, Color.Gray)
- for y = 0 to h - 1 do
- res.SetPixel(half w, y, Color.Gray)
- res
- let private isDraw (x, y, h, w) =
- if ((x <= 0) || (x >= w)) then false
- else
- if ((y <= 0) || (y >= h)) then false
- else
- true
- let Draw_0 (image : Bitmap) =
- let (res : Bitmap) = DrawBack image
- let h = res.Height
- let w = res.Width
- let pos_x x = x + half w
- let pos_y y = (half h) - y
- for x = -(half w) to (half w) do
- let y = func_i x
- if isDraw ((pos_x x), (pos_y y), h, w) then
- res.SetPixel(pos_x x, pos_y y, Color.Red)
- res
- let Draw_1 (image : Bitmap) =
- let (res : Bitmap) = DrawBack image
- let h = res.Height
- let w = res.Width
- let pos_x x = x + half w
- let pos_y y = (half h) - y
- for x = -(half w) to (half w) do
- for f = 0 to 9 do
- let tx = toFloat_1(x, f)
- let ty = Math.Round(func_f tx)
- let y = Convert.ToInt32(ty)
- if isDraw ((pos_x x), (pos_y y), h, w) then
- res.SetPixel(pos_x x, pos_y y, Color.Red)
- res
- let Draw_2 (image : Bitmap) =
- let (res : Bitmap) = DrawBack image
- let h = res.Height
- let w = res.Width
- let pos_x x = x + half w
- let pos_y y = (half h) - y
- for x = -(half w) to (half w) do
- for f1 = 0 to 9 do
- for f2 = 0 to 9 do
- let tx = toFloat_2(x, f1, f2)
- let ty = Math.Round(func_f tx)
- let y = Convert.ToInt32(ty)
- if isDraw ((pos_x x), (pos_y y), h, w) then
- res.SetPixel(pos_x x, pos_y y, Color.Red)
- res
- let Draw_3 (image : Bitmap) =
- let (res : Bitmap) = DrawBack image
- let h = res.Height
- let w = res.Width
- let pos_x x = x + half w
- let pos_y y = (half h) - y
- for x = -(half w) to (half w) do
- for f1 = 0 to 9 do
- for f2 = 0 to 9 do
- for f3 = 0 to 9 do
- let tx = toFloat_3(x, f1, f2, f3)
- let ty = Math.Round(func_f tx)
- let y = Convert.ToInt32(ty)
- if isDraw ((pos_x x), (pos_y y), h, w) then
- res.SetPixel(pos_x x, pos_y y, Color.Red)
- res
- //-----------------------------------------------------------------------------------
- let private toFloat_3 (n : int, f1 : int, f2 : int, f3 : int) =
- Convert.ToDouble(n) +
- Convert.ToDouble(f1) / 10.0 +
- Convert.ToDouble(f1) / 100.0 +
- Convert.ToDouble(f1) / 1000.0
- let Draw_3 (image : Bitmap) =
- let (res : Bitmap) = DrawBack image
- let h = res.Height
- let w = res.Width
- let pos_x x = x + half w
- let pos_y y = (half h) - y
- for x = -(half w) to (half w) do
- for f1 = 0 to 9 do
- for f2 = 0 to 9 do
- for f3 = 0 to 9 do
- let tx = toFloat_3(x, f1, f2, f3)
- let ty = Math.Round(func_f tx)
- let y = Convert.ToInt32(ty)
- if isDraw ((pos_x x), (pos_y y), h, w) then
- res.SetPixel(pos_x x, pos_y y, Color.Red)
- res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement