随笔分类 - ACM——计算几何模板
摘要:/*给出三维空间中的n个顶点,求解由这n个顶点构成的凸包表面的多边形个数. 增量法求解:首先任选4个点形成的一个四面体,然后每次新加一个点,分两种情况: 1> 在凸包内,则可以跳过 2> 在凸包外,找到从这个点可以"看见"的面,删除这些面, 然后对于一边没有面的线段,和新加的这个点新建一个面,至于这
阅读全文
摘要:#include #include #include #include #include #include #include using namespace std; #define MAX_N 110 /*------------------常量区-------------------*/ const double INF = 1e10; // 无穷...
阅读全文
摘要:void CirAndCut(Point psn[],int n,Point psm[],int m) { int nid=0,mid=0; for(int i=1;i<n;i++) if(psn[i].y>psn[nid].y) { nid=i; } for(int i=1;i<m;i++) if
阅读全文
摘要://最小圆覆盖//输入: 从下标0开始的点集_ps和大小_n//输出: 覆盖所有点的最小圆//复杂度: O(n)//注意: 会对_ps进行随机处理操作,将会改变点集的内部顺序Circle MinCoverCir(Point _ps[],int _n){ //随机处理,但是会改变传入的点集。 ...
阅读全文
摘要:#include <iostream> #include <cmath> #include <vector> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <algorithm> using namespace
阅读全文
摘要:1. d维空间中一个规则几何体n刀最多能切成几块f(d,n)。f(d,n) = f(d,n-1) + f(d-1,n-1) 这不就是组合数递推公式。。。于是 f(1,n)=1+nf(2,n)=1+n+n*(n-1)/2f(3,n)=1+n+n*(n-1)/2+n*(n-1)*(n-2)/6 = (...
阅读全文
摘要:精度比acos , asin 什么的高些。ParametersyValue representing the proportion of the y-coordinate.xValue representing the proportion of the x-coordinate.If both a...
阅读全文
摘要:计算几何头疼的地方一般在于代码量大和精度问题,代码量问题只要平时注意积累模板一般就不成问题了。精度问题则不好说,有时候一个精度问题就可能成为一道题的瓶颈,简直“画龙点睛”。这些年的题目基本是朝着越来越不卡精度的方向发展了,但是也不乏一些%^&%题#$%$^,另外有些常识不管题目卡不卡,都是应该知道的...
阅读全文
摘要:#include #include #include #include #define MAX_N 100using namespace std; /////////////////////////////////////////////////////////////////////常量区c...
阅读全文