[Geometry A-1] Locate point - to the right, to the left or on the vector?
Description:
Task
Your task is to determine the relationship between the given point and the vector. Direction of the vector is important! To determine if the point is to the left or to the right, you should imagine yourself standing at the beginning of the vector and looking at the end of the vector.
Arguments
You are given coordinates of a point and coordinates of a vector on 2D plane:
point = [x, y]
vector = [[x, y], [x, y]]
(two points, direction is from first to second)
Vectors always have non-zero length, so you don't have to check for that at this point.
Return
Your function must return:
-1
if the point is to the left of the vector,
0
if the point is on the same line as vector,
1
if the point is to the right of the vector.
Do not repeat yourself!
You can consider re-using solution of this kata in some of the next Geometry katas:
Similar Kata:
Stats:
Created | May 8, 2015 |
Published | May 8, 2015 |
Warriors Trained | 2146 |
Total Skips | 434 |
Total Code Submissions | 8860 |
Total Times Completed | 686 |
Python Completions | 447 |
JavaScript Completions | 202 |
Ruby Completions | 71 |
CoffeeScript Completions | 15 |
COBOL Completions | 9 |
Total Stars | 69 |
% of votes with a positive feedback rating | 93% of 127 |
Total "Very Satisfied" Votes | 111 |
Total "Somewhat Satisfied" Votes | 13 |
Total "Not Satisfied" Votes | 3 |