- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Program to find equation of a plane passing through 3 points in C++

In this tutorial, we will be discussing a program to find equation of a plane passing through 3 points.

For this we will be provided with 3 points. Our task is to find the equation of the plane consisting of or passing through those three given points.

## Example

#include <bits/stdc++.h> #include<math.h> #include <iostream> #include <iomanip> using namespace std; //finding the equation of plane void equation_plane(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3){ float a1 = x2 - x1; float b1 = y2 - y1; float c1 = z2 - z1; float a2 = x3 - x1; float b2 = y3 - y1; float c2 = z3 - z1; float a = b1 * c2 - b2 * c1; float b = a2 * c1 - a1 * c2; float c = a1 * b2 - b1 * a2; float d = (- a * x1 - b * y1 - c * z1); std::cout << std::fixed; std::cout << std::setprecision(2); cout << "Equation of plane is " << a << " x + " << b << " y + " << c << " z + " << d << " = 0"; } int main(){ float x1 =-1; float y1 = 2; float z1 = 1; float x2 = 0; float y2 =-3; float z2 = 2; float x3 = 1; float y3 = 1; float z3 =-4; equation_plane(x1, y1, z1, x2, y2, z2, x3, y3, z3); return 0; }

## Output

Equation of plane is 26.00 x + 7.00 y + 9.00 z + 3.00 = 0

- Related Articles
- Program to find line passing through 2 Points in C++
- Find the centre of a circle passing through the points $(6, -6), (3, -7)$ and $(3, 3)$.
- Write the equation of the line that is parallel to x-axis and passing through the points.$(0, 3)$
- Write the equation of the line that is parallel to y-axis and passing through the points.$(3, 5)$
- Write the equation of the line that is parallel to y-axis and passing through the points.$(-4, -3)$
- C++ Program to check whether points in a 3-D plane are Coplanar
- Write the equation of the line that is parallel to x-axis and passing through the points.$(0, -4)$
- Write the equation of the line that is parallel to x-axis and passing through the points.$(2, -5)$
- Write the equation of the line that is parallel to y-axis and passing through the points.$(4, 0)$
- Write the equation of the line that is parallel to y-axis and passing through the points.$(-2, 0)$
- Find the centre of the circle passing through $(6, -6), (3, -7)$ and $(3, 3)$.
- Plot the points $(3, 5)$ and $(-1, 3)$ on a graph paper and verify that the straight line passing through these points also passes through the point $(1, 4)$.
- Write the equal of the line that is parallel to x-axis and passing through the points.$(3, 4)$
- C++ Program to Find All Roots of a Quadratic Equation
- C++ Program to Find Number of Articulation points in a Graph

Advertisements