测试目标点是否在多边形内
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的更多相关文章

  1. 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, ...

  2. PNPoly算法代码例子,判断一个点是否在多边形里面

    写C语言的实验用到的一个算法,判断一个点是否在多边形的内部.C的代码如下: int pnpoly(int nvert, float *vertx, float *verty, float testx, ...

  3. 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 ...

  4. SVG & convert polygon/polyline to path

    SVG & convert polygon/polyline to path SVG Polygon/Polyline to Path Converter https://codepen.io ...

  5. lucene入门创建索引——(二)

    1.程序宏观结构图

  6. 【ASC 23】G. ACdream 1429 Rectangular Polygon --DP

    题意:有很多棍子,从棍子中选出两个棍子集合,使他们的和相等,求能取得的最多棍子数. 解法:容易看出有一个多阶段决策的过程,对于每个棍子,我们有 可以不选,或是选在第一个集合,或是选在第二个集合 这三种 ...

  7. LightOJ 1285 - Drawing Simple Polygon (几何,极角排序)

    1285 - Drawing Simple Polygon   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: ...

  8. [算法]A General Polygon Clipping Library

    A General Polygon Clipping Library Version 2.32    http://www.cs.man.ac.uk/~toby/alan/software/gpc.h ...

  9. POJ 1179 IOI1998 Polygon

    Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5472   Accepted: 2334 Description Polyg ...

随机推荐

  1. CDZSC_2015寒假新人(1)——基础 b

    Description The highest building in our city has only one elevator. A request list is made up with N ...

  2. spring的IOC,DI及案例详解

    一:spring的基本特征 Spring是一个非常活跃的开源框架:它是一个基于Core来架构多层JavaEE系统的框架,它的主要目的是简化企业开发.Spring以一种非侵入式的方式来管理你的代码,Sp ...

  3. Java之利用Socket获取网站内容

    public void main(String[] args){ String host = "123.126.113.42"; int port = 80; Socket s = ...

  4. Android应用截图嵌入到真实设备

    Device Art Generator 你可以使用 Device Art Generator 方便快捷地将应用截图嵌入到真实设备的效果图中.这样,当用户在你的网站上或其他宣传材料中看到你的应用截图时 ...

  5. html5学习笔记2

    css3选择器 1.通过元素的关键字,如p,div等 2.通过id属性 3.通过class属性引用 3.1通过class属性引用p标签,如:p.text{}//text样式只适用于p 4.通过任意键引 ...

  6. python实现zabbix_sender的socket通信代码样例

    sk = socket.socket() sk.connect(self.ip_port) sk.settimeout(5) sk.sendall(b'ZBXD\x01') sk.sendall(b' ...

  7. mysql tee 命令

    tee 命令说明: 用过mysql的应该都会知道mysql有一个叫show 的命令,这个命令应该是SQL标准之外的一个扩展:和这个类似mysql还扩展了一个叫tee的命令. tee的功能是把你的所有输 ...

  8. mobile端

    1.技术解决方案--------->(widget/event/ajax)->function->data------>XMLHttpRequest----->Serve ...

  9. WPF 动态更改启动窗体startupUri

    原文:WPF 动态更改启动窗体startupUri 第一步: 在 App.xaml 里,把 StartupUri=""去掉,改成  Startup="Applicatio ...

  10. Linux下安装nfs服务器

    1. 安装nfs服务 $sudo apt-get install nfs-kernel-server portmap 2. 在配置文件/etc/exports中添加以下内容/home/jxhui/nf ...