判断四点是否共面,判断四个点构成的三个向量混合积是否为0
#include<iostream>
#include<cstdio>
#include<math.h>
#include<cstring>
#include<algorithm>
#include<queue>
#include<set>
#include<vector>
using namespace std;
typedef struct node{
double x,y,z;
};
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
node no[10];
for(int j=0;j<4;j++){
scanf("%lf%lf%lf",&no[j].x,&no[j].y,&no[j].z);
}
double x1=no[1].x-no[0].x,y1=no[1].y-no[0].y,z1=no[1].z-no[0].z;
double x2=no[2].x-no[0].x,y2=no[2].y-no[0].y,z2=no[2].z-no[0].z;
double x3=no[3].x-no[0].x,y3=no[3].y-no[0].y,z3=no[3].z-no[0].z;
if(x1*(y2*z3-z2*y3)-y1*(x2*z3-z2*x3)+z1*(x2*y3-y2*x3)==0){
printf("Yes\n");
}
else printf("No\n");
}
return 0;
}