Given three integers a, b and c which represents coefficients of the equation of a line a * x + b * y – c = 0. Given two integer points (x1, y1) and (x2, y2). The task is to determine whether the points (x1, y1) and (x2, y2) lie on the same side of the given line or not.
Input : a = 1, b = 1, c = 1, x1 = 1, y1 = 1, x2 = 1, y2 = 2
Output : yes
On applying (x1, y1) and (x2, y2) on a * x + b * y – c, gives 1 and 2 respectively both of which have the same sign, hence both the points lie on same side of the line.
Input : a = 1, b = 1, c = 1, x1 = 1, y1 = 1, x2 = 0, y2 = 0
Output : no
Approach : Apply both the points on given line equation and check if the obtained values belong to same parity or not.
Below is the implementation of the above approach:
- Minimum number of points to be removed to get remaining points on one side of axis
- Represent a given set of points by the best possible straight line
- Count maximum points on same line
- Program to find line passing through 2 Points
- Find points at a given distance on a line of given slope
- Find X and Y intercepts of a line passing through the given points
- Count distinct points visited on the number line
- Number of ordered points pair satisfying line equation
- Number of horizontal or vertical line segments to connect 3 points
- Check whether four points make a parallelogram
- How to check if given four points form a square
- Check if the given 2-D points form T-shape or not
- Program to check if three points are collinear
- Program to check whether 4 points in a 3-D plane are Coplanar
- Check whether it is possible to join two points given on circle such that distance between them is k
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.