C算法
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
typedef struct _POINT_DATA_
{
double lat; //range -90.0000000 to + 90.0000000 degree Units of 1/10 micro degree
double Long; //range -180.0000000 to + 180.0000000 degree Units of 1/10 micro degree
}POINT_DATA_T;
typedef struct _POINT_ARR
{
int pointNum;
POINT_DATA_T pointArr[10];
}POINT_ARR_T;
int isPtInPoly(double ALon, double ALat, POINT_ARR_T *APoints)
{
if (APoints->pointNum < 3)
{
return -1;
}
int iSum, iCount, iIndex;
double dLon1 = 0, dLon2 = 0, dLat1 = 0, dLat2 = 0, dLon;
iSum = 0;
iCount =<

本文介绍了一个C语言实现的算法,用于判断一个给定点是否位于由一组经纬度坐标定义的多边形内。通过逐边比较点的位置关系,计算可能的交点并确定是否在多边形范围内。适用于地理空间定位和几何形状检查。
最低0.47元/天 解锁文章
1411





