随笔分类 -  ACM~~计算几何

摘要:今天在阅读chipmunk2D源码时,在cpBB.h中看到了一个判读矩阵相交的函数static inline cpBool cpBBIntersects(const cpBB a, const cpBB b){ return (a.l b.l || a.t b.t); }还有一种方法就是根据两个矩阵相交形成的矩阵判断,两个矩阵相交的结果一定是一个矩阵,构成相交矩阵为CRect{newLeft,newBottom,newRight,newTop}newLeft = max(a.l,b.l)newBottom = max(a.t,b.t)newRight... 阅读全文
posted @ 2013-11-19 11:55 OpenSoucre 阅读(2330) 评论(0) 推荐(0)
摘要:#include #include const double eps = 1e-10;struct Point{ double x,y; Point(double x = 0, double y = 0):x(x),y(y){} //初始化列表构造函数};typedef Point Vector;//向量+向量 = 向量, 点 + 向量 = 向量Vector operator + (Vector A, Vector B){return Vector(A.x+B.x, A.y+B.y);}//点-点=向量Vector operator - (Point A,Point B){retu... 阅读全文
posted @ 2013-11-18 00:29 OpenSoucre 阅读(336) 评论(0) 推荐(0)