PNPOLY - Point Inclusion in Polygon W. Randolph Franklin
测试目标点是否在多边形内
int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy)
{
int i, j, c = 0;
for (i = 0, j = nvert-1; i < nvert; j = i++) {
if ( ((verty[i]>testy) != (verty[j]>testy)) &&
(testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
c = !c;
}
return c;
}
| Argument | Meaning |
|---|---|
| nvert | Number of vertices in the polygon. Whether to repeat the first vertex at the end is discussed below. |
| vertx, verty | Arrays containing the x- and y-coordinates of the polygon's vertices. |
| testx, testy | X- and y-coordinate of the test point. |
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
PNPOLY - Point Inclusion in Polygon W. Randolph Franklin的更多相关文章
- PNPOLY - Point Inclusion in Polygon Test
https://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html The C Code Here is the code, ...
- PNPoly算法代码例子,判断一个点是否在多边形里面
写C语言的实验用到的一个算法,判断一个点是否在多边形的内部.C的代码如下: int pnpoly(int nvert, float *vertx, float *verty, float testx, ...
- Determining if a point lies on the interior of a polygon
Determining if a point lies on the interior of a polygon Written by Paul Bourke November 1987 Solut ...
- SVG & convert polygon/polyline to path
SVG & convert polygon/polyline to path SVG Polygon/Polyline to Path Converter https://codepen.io ...
- lucene入门创建索引——(二)
1.程序宏观结构图
- 【ASC 23】G. ACdream 1429 Rectangular Polygon --DP
题意:有很多棍子,从棍子中选出两个棍子集合,使他们的和相等,求能取得的最多棍子数. 解法:容易看出有一个多阶段决策的过程,对于每个棍子,我们有 可以不选,或是选在第一个集合,或是选在第二个集合 这三种 ...
- LightOJ 1285 - Drawing Simple Polygon (几何,极角排序)
1285 - Drawing Simple Polygon PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: ...
- [算法]A General Polygon Clipping Library
A General Polygon Clipping Library Version 2.32 http://www.cs.man.ac.uk/~toby/alan/software/gpc.h ...
- POJ 1179 IOI1998 Polygon
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5472 Accepted: 2334 Description Polyg ...
随机推荐
- 屏蔽鼠标右键功能JS
<script language="Javascript"> function hiderightKey(){ return false; } docum ...
- [Oracle]查看和修改连接数
#登陆数据库sqlplus system/*** as sysdba #显示当前最大连接数:show parameter processes; show parameter sessions; #修改 ...
- 【搜索引擎Jediael开发笔记3】使用HtmlParser提取网页中的链接
关于HtmpParser的基本内容请见 HtmlParser基础教程 本文示例用于提取HTML文件中的链接 package org.ljh.search.html; import java.util. ...
- Python Tkinter canvas oval原理
Ovals, mathematically, are ellipses, including circles as a special case. The ellipse is fit into a ...
- CSS混合模式
前面的话 层叠上下文z-index只是解决两个元素覆盖,谁离用户更近的问题.而CSS混合模式,则是处理两个元素覆盖部分如何混合的问题.如果了解photoshop的话,对这种现象应该不陌生.CSS3 ...
- 怎么查看mysql执行过的sql。
有些时候当程序做了更新,数据库负载突然上来,或者并发翻了几倍.这个时候如果用show full processlist; 根本看不到完全的sql.怎么才能看是哪些sql导致的呢,在网上查了资料,有一下 ...
- Ubuntu 14.04卸载安装失败的Mysql数据库,以及重新安装配置
一.删除原来Mysql 1.删除mysql的数据文件 sudo rm /var/lib/mysql/ -R 2.删除mqsql的配置文件 sudo rm /etc/mysql/ -R 3.自动卸载my ...
- Azure上如何在Linux下挂载数据磁盘
[原文首次发表于51cto http://cloudapps.blog.51cto.com/3136598/1653672] 在Azure上创建了虚拟机之后,我们在一些情况下会需要添加更多的数据磁盘来 ...
- webview相关链接
http://tech.it168.com/a2011/0517/1191/000001191561_2.shtml http://www.eoeandroid.com/thread-272495-1 ...
- WPF中实现先登录后启动主程序的方法
原文:WPF中实现先登录后启动主程序的方法 我觉得先登录后启动应用主程序是一个很经典的问题,基本上如果要写一个应用程序都会用到这个的小环节.我在这个问题上挣扎了大半天才找到解决方案,我的实现方法我觉得 ...