Given 4 points (x1, y1, z1), (x2, y2, z2), (x3, y3, z3), (x4, y4, z4). The task is to write a program to check whether these 4 points are coplanar or not.
Note: 4 points in a 3-D plane are said to be coplanar if they lies in the same plane.
Input: x1 = 3, y1 = 2, z1 = -5 x2 = -1, y2 = 4, z2 = -3 x3 = -3, y3 = 8, z3 = -5 x4 = -3, y4 = 2, z4 = 1 Output: Coplanar Input: x1 = 0, y1 = -1, z1 = -1 x2 = 4, y2 = 5, z2 = 1 x3 = 3, y3 = 9, z3 = 4 x4 = -4, y4 = 4, z4 = 3 Output: Not Coplanar
- To check whether 4 points are coplanar or not, first of all, find the equation of the plane passing through any three of the given points.
Approach to find equation of a plane passing through 3 points.
- Then, check whether the 4th point satisfies the equation obtained in step 1. That is, putting the value of 4th point in the equation obtained. If it satisfies the equation then the 4 points are Coplanar otherwise not.
Below is the implementation of the above idea:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program to find equation of a plane passing through 3 points
- Maximum distance between two points in coordinate plane using Rotating Caliper's Method
- Number of triangles in a plane if no more than two points are collinear
- Find the equation of plane which passes through two points and parallel to a given axis
- Hammered distance between N points in a 2-D plane
- Check whether four points make a parallelogram
- Check whether it is possible to join two points given on circle such that distance between them is k
- Check whether two points (x1, y1) and (x2, y2) lie on same side of a given line or not
- Check whether triangle is valid or not if three points are given
- Check whether a straight line can be formed using N co-ordinate points
- Check if a line at 45 degree can divide the plane into two equal weight parts
- Number of Integral Points between Two Points
- Prime points (Points that split a number into two primes)
- Count of obtuse angles in a circle with 'k' equidistant points between 2 given points
- Minimum number of points to be removed to get remaining points on one side of axis
- Steps required to visit M points in order on a circular ring of N points
- Find the point on X-axis from given N points having least Sum of Distances from all other points
- Ways to choose three points with distance between the most distant points <= L
- Program to determine the quadrant of the cartesian plane
- Program to determine the octant of the axial plane
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.