摘要: 点B到直线AC的距离 就是 |AB X AC|/|AC| ‘X’是叉乘 ’ || ‘表示模View Code 1 /* 2 三维+点到直线的距离 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue>10 //#include<map>11 #include<math.h>12 using namesp 阅读全文
posted @ 2013-03-19 21:52 xxx0624 阅读(683) 评论(0) 推荐(0) 编辑
摘要: 二维叉积View Code 1 struct point{2 double x,y;3 };4 double xmult( point a,point b,point c ){5 return ( b.x-a.x )*( c.y-a.y )-( b.y-a.y )*( c.x-a.x );6 }c||a-- -- -- -- --b由b转向a!!三维叉积设A(x1,y1,zi)、B(x2,y2,z2)、C(x3,y3,z3)为不共线三点,向量AB={x2-x1,y2-y1,z2-z1}向量AC={x3-x1,y3-y1,z3-z1}由A、B、C三点确定的平面的法向量就是向量AB... 阅读全文
posted @ 2013-03-19 21:49 xxx0624 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 先算重心!!!!!!再算凸包!!!!!!!View Code 1 /* 2 几何+重心 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue> 10 //#include<map> 11 #include<math.h> 12 using namespace std; 13 typedef long l 阅读全文
posted @ 2013-03-19 20:22 xxx0624 阅读(439) 评论(0) 推荐(0) 编辑
摘要: 详见代码View Code 1 /* 2 几何+线段相交 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue>10 //#include<map>11 #include<math.h>12 using namespace std;13 typedef long long ll;14 //typedef 阅读全文
posted @ 2013-03-19 18:27 xxx0624 阅读(249) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /* 2 几何+判断凸多边形 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue>10 //#include<map>11 #include<math.h>12 using namespace std;13 typedef long long ll;14 //typedef _ 阅读全文
posted @ 2013-03-19 14:43 xxx0624 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 详见代码View Code 1 /* 2 几何+判定点是否在多边形内 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<math.h> 8 const int maxn = 105; 9 const double eps = 1e-8;10 const int inf = 99999999;11 const int max_x = 1000;12 const int max_y = 1000;13 struct point{14 double 阅读全文
posted @ 2013-03-19 14:11 xxx0624 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 这是按照自己理解写的一个测试代码。。。简单易懂#include<stdio.h>#include<string.h>#include<stdlib.h>const int maxn = 10005;int a[ maxn ],c[ maxn ];int lowbit( int i ){ return i&(-i);}int sum( int i ){ int s=0; while( i>0 ){ s+=c[ i ]; i-=lowbit( i ); } return s;}void update( int i,int new_val,int p 阅读全文
posted @ 2013-03-19 10:38 xxx0624 阅读(206) 评论(0) 推荐(0) 编辑