Блог пользователя ganesh_6

Автор ganesh_6, история, 3 года назад, По-английски

I was solving the question http://codeforces.me/contest/227/problem/A. If the cross product is zero then obviously they are collinear since sin(x)=0 if x=2*n*PI. However, how do they decide if it is Left or Right based on the value of cross-product i.e; x1*y2-x2*y1. Please demystify this for me. Am I missing any fundamentals?

C++
  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
3 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Function cp calculates the z-coordinate of the cross product. Then you can use the right hand rule to determine the direction (angle CAB is always less than 90) If C is to the left => Thumb will go down => z-coordinate less than 0 => t is less than 0, and vice versa

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    Awesome! Now I remember my school days. These are the stuff I learned in my school in Physics and maths. Looks like I need to revise a lot in the process. Thanks a ton!