Topic Link: 51nod 12,654-point Coplanar
The necessary and sufficient condition of the three vector a,b,c Coplanar is that there are not all zeros of the real number x, Y, Z meet X*a+y*b+z*c=0, and then think of the line generation.
In fact, the three-vector mixed product is 0: (a,b,c) = (AXB) c=
|ax ay az|
|BX by bz| = Ax*by*cz+ay*bz*cx+bx*cy*az-az*by*cx-ay*bx*cz-ax*bz*cy = 0;
|CX Cy Cz|
When I saw the determinant, I thought of the linear algebra test, but I didn't preview it ~ ~ ~ (>_<) ~ ~ ~
1#include <cstdio>2#include <cstring>3#include <algorithm>4 using namespacestd;5 structpoint{6 intx, y, z7}p[3];8 intMain () {9 intT, I, K;Ten intx, y, z One intAx,ay,az,bx,by,bz,cx,cy,cz; Ascanf"%d", &t); - for(k =1; K <= T; ++k) { -scanf"%d%d%d",&x,&y,&z); the for(i =0; I <3; ++i) -scanf"%d%d%d",&p[i].x,&p[i].y,&p[i].z); -ax=p[0].x-x; ay=p[0].y-y; az=p[0].z-Z; -bx=p[1].x-x; by=p[1].y-y; bz=p[1].z-Z; +cx=p[2].x-x; cy=p[2].y-y; cz=p[2].z-Z; - if(Ax*by*cz+ay*bz*cx+bx*cy*az-az*by*cx-ay*bx*cz-ax*bz*cy = =0) +Puts"Yes"); A ElsePuts"No"); at } - return 0; -}
View Code
51nod1265 Four points common face