随笔分类 -  algorithm

判断多边形顺时针还是逆时针
摘要:public static boolean isClockwise(List pointList) { double maxY = 0.0D; int index = 0; //找到Y值最大的点及其前一点和后一点 for (int i = 0; i 0 , 则P在Q的顺时针方向。 //若 P × Q 0,ax * by - ay * bx>0,也就是大拇指指向朝上,所以P在Q的顺时针方向,一下同理。 PointD frontPt = (PointD) pointList.get(front)... 阅读全文

posted @ 2013-07-19 16:03 leungrs 阅读(2289) 评论(0) 推荐(0)

算法最佳实践积累
摘要:一、计算点到原点的距离,或者三角形斜边长public static double hypot(double x, double y) { if (x Effective Java" * * @return a hashcode for the double value... 阅读全文

posted @ 2013-04-17 10:51 leungrs 阅读(177) 评论(0) 推荐(0)