Created
September 11, 2014 11:11
-
-
Save akanehara/ce6ba336e58ba617b770 to your computer and use it in GitHub Desktop.
別解
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* 目的: 中点 *) | |
(* chuten : float * float -> float * float -> float * float *) | |
let chuten p q = | |
match (p, q) with | |
((px, py), (qx, qy)) -> | |
((px +. qx) /. 2., (py +. qy) /. 2.) | |
(* テスト *) | |
let chuten1 = chuten (1., 1.) (-1., -1.) = (0., 0.) | |
let chuten2 = chuten (-1., 1.) (1., -1.) = (0., 0.) | |
let chuten3 = chuten (100., 0.) (0., 100.) = (50., 50.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment