तीन बिंदु (x1,y1,z1), (x2,y2,z2), (x3,y3,z3) दिए गए हैं। उनसे गुजरने वाले तल का समीकरण ax + by + cz + d = 0 खोजें।
दिशा सदिश: a1=x2-x1, b1=y2-y1, c1=z2-z1 और a2=x3-x1, b2=y3-y1, c2=z3-z1। सामान्य सदिश = क्रॉस गुणनफल।
उदाहरण: बिंदु (-1,2,1), (0,-3,2), (1,1,-4) → तल: 26x + 7y + 9z + 3 = 0।
C++ कार्यान्वयन
#include <bits/stdc++.h>
#include <math.h>
#include <iostream>
#include <iomanip>
using namespace std;
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, b1 = y2 - y1, c1 = z2 - z1;
float a2 = x3 - x1, b2 = y3 - y1, 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);
cout << fixed << setprecision(2);
cout << "Equation of plane is " << a << " x + " << b << " y + " << c << " z + " << d << " = 0";
}
int main() {
float x1 = -1, y1 = 2, z1 = 1;
float x2 = 0, y2 = -3, z2 = 2;
float x3 = 1, y3 = 1, z3 = -4;
equation_plane(x1, y1, z1, x2, y2, z2, x3, y3, z3);
return 0;
}
आउटपुट
Equation of plane is 26.00 x + 7.00 y + 9.00 z + 3.00 = 0