- 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

# Angle between two Planes in 3D in C Program?

Here we will see how to calculate the angle between two planes in the three dimensional space. The planes are P1 and P2. The equations of Pi like below −

If the angle is ‘A’, then it will follow this rule −

## Example

#include <iostream> #include <cmath> using namespace std; class Plane{ private: double a, b, c, d; public: Plane(double a = 0, double b = 0, double c = 0, double d = 0){ this->a = a; this->b = b; this->c = c; this->d = d; } double friend angle(Plane p1, Plane p2); }; double angle(Plane p1, Plane p2){ double nume = (p1.a * p2.a) + (p1.b * p2.b) + (p1.c * p2.c); double deno1 = (p1.a * p1.a) + (p1.b * p1.b) + (p1.c * p1.c); double deno2 = (p2.a * p2.a) + (p2.b * p2.b) + (p2.c * p2.c); return (180.0 / 3.14159) * acos(nume/ (sqrt(deno1) * sqrt(deno2))); } int main() { Plane p1(2.0, 2.0, -3.0, -5.0), p2(3.0, -3.0, 5.0, -6.0); cout << "Angle: " << angle(p1, p2) << " degree"; }

## Output

Angle: 123.697 degree

- Related Articles
- Angle between two Planes in 3D in C++?
- C program to calculate distance between three points in 3D
- Program to find angle between hour and minute hands of a clock in C++?
- C# Program to determine the difference in hours between two dates
- C# Program to get the difference between two dates in seconds
- C++ Program to Find Path Between Two Nodes in a Graph
- Program to calculate the area between two Concentric Circles in C++?
- Program to Find the Shortest Distance Between Two Points in C++
- C program to display the prime numbers in between two intervals
- Best way to plot an angle between two lines in Matplotlib
- Angle Between Hands of a Clock in C++
- C program to calculate distance between two points
- Program to check two spheres can ever meet by accelerating or not in a 3D space in Python
- Find distance between two nodes of a Binary Tree in C++ Program
- C++ program to find the shortest distance between two nodes in BST

Advertisements