任意多边形的最大内切圆算法 您所在的位置:网站首页 圆内多边形周长是怎么推出来的 任意多边形的最大内切圆算法

任意多边形的最大内切圆算法

2024-07-11 21:56| 来源: 网络整理| 查看: 265

一 算法思想 网上找内切圆算法没找到理想的,在国外看到一篇文章,作者本人也有源码,编译没通过,自己重新写了下,实现了功能在 这里插入图来源 片描述

上图中在三角形形成的二维平面区域中,高度为H,宽度为W。将空间进行等分,高度为n份,宽度为m份,每份为H/n,W/m份 在空间形成网格,将三角区域外的点剔除掉。再剩下的点中,对每个点而言,找出到边最近的距离。这样在很多点中找出最大的距离点。这个点作为种子点。以种子点为中心的区域再剖分,循环迭代 二.代码部分

#define N_CELLS 20 #define M_CELLS 20 int FindInscribedCircleCenter(vector polygon, double* output) { if (polygon.size() bounds[1]) bounds[1] = pt.x; if (pt.y < bounds[2]) bounds[2] = pt.y; if (pt.y > bounds[3]) bounds[3] = pt.y; } cv::Point3f point_pia; float flt_tmp = FLT_MAX; int count = 1; cv::Point3f point_tmp;// = new cv::Point3f; while (count++) { // find new candidate PIA point_tmp


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有