summaryrefslogtreecommitdiffhomepage
path: root/digital/avr/modules/math/geometry/test/test_geometry.c
diff options
context:
space:
mode:
authorNicolas Schodet2010-04-27 00:17:22 +0200
committerNicolas Schodet2010-04-27 00:17:22 +0200
commit3d4c3356183686b97e8fa750b73ce727a59ff89f (patch)
tree966e4150a5c54b407cba7376eca33dcbb987ff5e /digital/avr/modules/math/geometry/test/test_geometry.c
parent332f2577aa20709b2e1761864bcb60b961d0d1bd (diff)
digital/avr/modules/math/geometry: add distance_point_point
Diffstat (limited to 'digital/avr/modules/math/geometry/test/test_geometry.c')
-rw-r--r--digital/avr/modules/math/geometry/test/test_geometry.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/digital/avr/modules/math/geometry/test/test_geometry.c b/digital/avr/modules/math/geometry/test/test_geometry.c
index 90c063bc..17afb787 100644
--- a/digital/avr/modules/math/geometry/test/test_geometry.c
+++ b/digital/avr/modules/math/geometry/test/test_geometry.c
@@ -197,6 +197,19 @@ test_distance (void)
{
vect_t a, b, p;
int16_t d;
+ /* distance_point_point. */
+ a.x = 100; a.y = 100;
+ b.x = 200; b.y = 200;
+ d = distance_point_point (&a, &b);
+ test (d == 141);
+ a.x = -100; a.y = -100;
+ b.x = -200; b.y = -200;
+ d = distance_point_point (&a, &b);
+ test (d == 141);
+ a.x = 0; a.y = -100;
+ b.x = 0; b.y = 200;
+ d = distance_point_point (&a, &b);
+ test (d == 300);
/* distance_segment_point. */
a.x = 300; a.y = 200;
b.x = 900; b.y = 500;