判断四个点是否共面
/*
? ? 已知四個點坐標判斷是否共面
? ? 可以用行列式來判斷
? ? 用四個點求出三個向量分別為(x1,y1,z1),(x2,y2,z2),(x3,y3,z3)
? ? 判斷行列式
? ? | x1 x2 x3|
? ? | y1 y2 y3|
? ? | z1 z2 z3|
? ? 或者它的轉置是否為零
? ? 若為零則四點共面
*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string.h>
#define mod p
#define MAX 3
#define ll long long
using namespace std;
int main()
{
? ? int t;
? ? cin>>t;
? ? while(t--)
? ? {
? ? ? ? int a1,b1,c1,a2,b2,c2;
? ? ? ? int x1,x2,x3,y1,y2,y3,z1,z2,z3;
? ? ? ? cin>>a1>>b1>>c1;
? ? ? ? cin>>a2>>b2>>c2;
? ? ? ? x1=a2-a1;
? ? ? ? y1=b2-b1;
? ? ? ? z1=c2-c1;
? ? ? ? cin>>a2>>b2>>c2;
? ? ? ? x2=a2-a1;
? ? ? ? y2=b2-b1;
? ? ? ? z2=c2-c1;
? ? ? ? cin>>a2>>b2>>c2;
? ? ? ? x3=a2-a1;
? ? ? ? y3=b2-b1;
? ? ? ? z3=c2-c1;
? ? ? ? if((x1*y2*z3)+(x2*y3*z1)+(x3*y1*z2)-(x3*y2*z1)-(y3*z2*x1)-(z3*x2*y1)==0)
? ? ? ? ? ? cout<<"Yes"<<endl;
? ? ? ? else
? ? ? ? ? ? cout<<"No"<<endl;
? ? }
? ? return 0;
}
? ? 已知四個點坐標判斷是否共面
? ? 可以用行列式來判斷
? ? 用四個點求出三個向量分別為(x1,y1,z1),(x2,y2,z2),(x3,y3,z3)
? ? 判斷行列式
? ? | x1 x2 x3|
? ? | y1 y2 y3|
? ? | z1 z2 z3|
? ? 或者它的轉置是否為零
? ? 若為零則四點共面
*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string.h>
#define mod p
#define MAX 3
#define ll long long
using namespace std;
int main()
{
? ? int t;
? ? cin>>t;
? ? while(t--)
? ? {
? ? ? ? int a1,b1,c1,a2,b2,c2;
? ? ? ? int x1,x2,x3,y1,y2,y3,z1,z2,z3;
? ? ? ? cin>>a1>>b1>>c1;
? ? ? ? cin>>a2>>b2>>c2;
? ? ? ? x1=a2-a1;
? ? ? ? y1=b2-b1;
? ? ? ? z1=c2-c1;
? ? ? ? cin>>a2>>b2>>c2;
? ? ? ? x2=a2-a1;
? ? ? ? y2=b2-b1;
? ? ? ? z2=c2-c1;
? ? ? ? cin>>a2>>b2>>c2;
? ? ? ? x3=a2-a1;
? ? ? ? y3=b2-b1;
? ? ? ? z3=c2-c1;
? ? ? ? if((x1*y2*z3)+(x2*y3*z1)+(x3*y1*z2)-(x3*y2*z1)-(y3*z2*x1)-(z3*x2*y1)==0)
? ? ? ? ? ? cout<<"Yes"<<endl;
? ? ? ? else
? ? ? ? ? ? cout<<"No"<<endl;
? ? }
? ? return 0;
}
總結
- 上一篇: allegro修改铜皮网络
- 下一篇: 我所使用的五大返利网站使用比较