Module: Geometry. Product of vectors


Problem

2 /5


Belonging of a point to a ray

Theory Click to read/hide

Let \(C(x,y)\) be the coordinates of the point, \(A (a,b)\) - vector start coordinates, \(B(c,d)\) - vector end coordinates. First, let's find out if the point lies on the line AB! To do this, you need to calculate the skew product of the vectors AB and AC! If it is zero, then the point lies on the line! Then calculate the scalar product of the vectors AB< /code> and AC! If it is >=0 then the point belongs to the ray defined by the vector otherwise not.

Problem

Input
Six numbers – the coordinates of the point and the coordinates of the start and end of the vector.
 
Output
One line “YES” if the point belongs to the ray defined by the vector and “NO” otherwise.

 

Examples
# Input Output
1 4 0 4 2 4 5 NO