| 8 | } |
| 9 | |
| 10 | void test() { |
| 11 | /* Field testing: UVa10263, Kattis segmentdistance */ |
| 12 | |
| 13 | assert_equal(point(-3, 3), rotate(point(3, 3), pi / 2, point(0,0))); |
| 14 | assert_equal(point(-3, 3), rotate(point(3, 3))); |
| 15 | assert_equal(point(-3, -3), rotate(point(3, 3), pi, point(0,0))); |
| 16 | assert_equal(point(3, -3), rotate(point(3, 3), pi + pi / 2, point(0,0))); |
| 17 | assert_equal(point(3, 3), rotate(point(3, 3), 2 * pi, point(0,0))); |
| 18 | |
| 19 | // assert_equal(point(0.7071067811,0.7071067811), normalize(point(2,2))); |
| 20 | assert_equal(point(cos(pi/4), sin(pi/4)), normalize(point(2,2))); |
| 21 | assert_equal(point(0,0), normalize(point(0,0))); |
| 22 | assert_equal(point(0,1), normalize(point(0,100))); |
| 23 | assert_equal(point(1,0), normalize(point(100,0))); |
| 24 | assert_equal(point(-1,0), normalize(point(-2,0))); |
| 25 | assert_equal(point(0,-1), normalize(point(0,-2))); |
| 26 | assert_equal(point(cos(pi/3), sin(pi/3)), normalize(point(cos(pi/3) * 2, sin(pi/3) * 2))); |
| 27 | |
| 28 | assert_equal(point(6.0/25, -8.0/25), proj(point(-3, 4), point(2, 1))); |
| 29 | } |
| 30 | // vim: cc=60 ts=2 sts=2 sw=2: |
nothing calls this directly
no test coverage detected