标签:style blog http color os io for ar
给出边长,直接就可以求出体积咯
关于欧拉四面体公式的推导及证明过程
2010-08-16 14:18
1,建议x,y,z直角坐标系。设A、B、C少拿点的坐标分别为(a1,b1,c1),(a2,b2,c2),(a3,b3,c3),四面体O-ABC的六条棱长分别为l,m,n,p,q,r; |
摘自:http://www.cnblogs.com/kuangbin/archive/2012/04/13/2446378.html
代码:
//#pragma comment(linker, "/STACK:16777216") //for c++ Compiler #include <stdio.h> #include <iostream> #include <cstring> #include <cmath> #include <stack> #include <queue> #include <vector> #include <algorithm> #define ll long long #define Max(a,b) (((a) > (b)) ? (a) : (b)) #define Min(a,b) (((a) < (b)) ? (a) : (b)) #define Abs(x) (((x) > 0) ? (x) : (-(x))) using namespace std; double P( double a,double b,double c,double d,double e ){ return a*(b*c-d*e); } double EulerTetrahedron(double OA, double OB, double OC, double AB, double BC, double CA){ OA *= OA; OB *= OB; OC *= OC; AB *= AB; CA *= CA; BC *= BC; double ans = 0; ans += P( OA,OB,OC,(OB+OC-BC)/2.,(OB+OC-BC)/2. ); ans -= P( (OA+OB-AB)/2.,(OA+OB-AB)/2.,OC,(OA+OC-CA)/2.,(OB+OC-BC)/2. ); ans += P( (OA+OC-CA)/2.,(OA+OB-AB)/2.,(OB+OC-BC)/2.,OB,(OA+OC-CA)/2.); return sqrt(ans/36); } int main(){ double OA,OB,OC,AB,BC,CA; while( scanf("%lf%lf%lf%lf%lf%lf",&OA,&OB,&OC,&AB,&CA,&BC)!=EOF ){ printf("%.4f\n",euler(OA, OB, OC, AB, BC, CA)); } return 0; }
POJ 2208 Pyramids 欧拉四面体,布布扣,bubuko.com
标签:style blog http color os io for ar
原文地址:http://www.cnblogs.com/wushuaiyi/p/3925434.html