Permalink
Browse files

Prevent division by 0 in coordinates conversion

  • Loading branch information...
1 parent 790032d commit 3dfa32f62148eccf6a157ebae7c0d8d4a312a7e6 @joaquimrocha committed Oct 4, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 skeltrack/skeltrack-util.c
@@ -612,6 +612,13 @@ convert_mm_to_screen_coords (guint width,
gfloat width_height_relation =
width > height ? (gfloat) width / height : (gfloat) height / width;
+ if (z + MIN_DISTANCE == 0)
+ {
+ *i = 0;
+ *j = 0;
+ return;
+ }
+
*i = round (width / 2.0 + x / ((gfloat) (z + MIN_DISTANCE) * SCALE_FACTOR *
dimension_reduction * width_height_relation));
*j = round (height / 2.0 + y / ((gfloat) (z + MIN_DISTANCE) * SCALE_FACTOR *

0 comments on commit 3dfa32f

Please sign in to comment.