点到线段的最短距离
来源:互联网 发布:java简历个人评价 编辑:程序博客网 时间:2024/05/17 03:13
点到线段的最短距离
- Java code
- private double pointToLine(int x1, int y1, int x2, int y2, int x0, int y0) { double space = 0; double a, b, c; a = lineSpace(x1, y1, x2, y2);// 线段的长度 b = lineSpace(x1, y1, x0, y0);// (x1,y1)到点的距离 c = lineSpace(x2, y2, x0, y0);// (x2,y2)到点的距离 if (c <= 0.000001 || b <= 0.000001) { space = 0; return space; } if (a <= 0.000001) { space = b; return space; } if (c * c >= a * a + b * b) { space = b; return space; } if (b * b >= a * a + c * c) { space = c; return space; } double p = (a + b + c) / 2;// 半周长 double s = Math.sqrt(p * (p - a) * (p - b) * (p - c));// 海伦公式求面积 space = 2 * s / a;// 返回点到线的距离(利用三角形面积公式求高) return space; } // 计算两点之间的距离 private double lineSpace(int x1, int y1, int x2, int y2) { double lineLength = 0; lineLength = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); return lineLength; }
- 点到线段最短距离的算法
- 点到线段的最短距离
- 点到线段的最短距离
- 点到线段的最短距离
- 点到线段的最短距离
- 点到线段的最短距离
- 点到线段的最短距离算法
- 点到线段的最短距离算法
- 点到线段的最短距离
- 点到线段的最短距离
- 点到线段的最短距离
- 点到线段的最短距离算法
- java 代码 点到线段的最短距离
- 计算点到线段最短距离的代码
- UVa 10263 Railway (点到线段的最短距离)
- java 代码 点到线段的最短距离
- uva10263 Railway点到线段的最短距离
- as3 点到线段最短距离 函数
- C++ Primer笔记(5)
- ORA-01034: ORACLE not available和ORA-27101: shared memory realm does not texis
- python简明教程练习--命令行 地址簿 程序
- 关于64位整型数据的问题
- 黑马程序员java笔记之四-----IO流
- 点到线段的最短距离
- hibernate 3.2.7 支持SQL SERVER 2005+的分页
- qRegister
- firefox的神器
- jqGrid 参数 详解
- Struts2的运行机制
- fork()
- java哈弗曼编码的实现
- 埋藏