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:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Program to find equation of a plane passing through 3 points
- Hammered distance between N points in a 2-D plane
- Number of triangles in a plane if no more than two points are collinear
- Program to check if three points are collinear
- Find the equation of plane which passes through two points and parallel to a given axis
- Maximum distance between two points in coordinate plane using Rotating Caliper's Method
- Program to check if the points are parallel to X axis or Y axis
- Program to find X, Y and Z intercepts of a plane
- Program to determine the quadrant of the cartesian plane
- Program to determine the octant of the axial plane
- Check if a line at 45 degree can divide the plane into two equal weight parts
- Check whether two points (x1, y1) and (x2, y2) lie on same side of a given line or not
- Check if the given 2-D points form T-shape or not
- Check whether triangle is valid or not if three points are given
- Check whether four points make a parallelogram
- How to check if given four points form a square
- Check if two people starting from different points ever meet
- Check whether it is possible to join two points given on circle such that distance between them is k
- Check whether a straight line can be formed using N co-ordinate points
- Program to calculate distance between two points in 3 D
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.