Permalink
Browse files

add comments for problem102

  • Loading branch information...
1 parent 41939ca commit de286ff24ca42c4eab94e6823c3ef042d7b3945c @tingleshao committed Jun 7, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 problem101to110/problem102.py
@@ -1,5 +1,10 @@
# problem 102
-
+# If all ys or all xs have the same sign, (including zero case) the triangle does not contain
+# the origin.
+# If two of them have the same sign while the other one has the opposite sign, then check the zero
+# crossing between that one and the other two. If the zero crossings have opposite sign, then
+# the triangle contains the origin, otherwise it does not.
+# This covers all the cases.
def containsOrigin(x1,y1,x2,y2,x3,y3):
if (x1 >= 0 and x2 >= 0 and x3 >= 0):

0 comments on commit de286ff

Please sign in to comment.