/// <summary> /// /// </summary> /// <param name="edge"></param> /// <returns></returns> #else /// <summary> /// /// </summary> /// <param name="edge"></param> /// <returns></returns> #endif public static CvSubdiv2DEdge SUBDIV2D_NEXT_EDGE(CvSubdiv2DEdge edge) { unsafe { ulong edgeValue = (ulong)edge; WCvQuadEdge2D *ptr = (WCvQuadEdge2D *)((long)edgeValue & ~3L); int edge3 = (int)(edgeValue & 3); return(new CvSubdiv2DEdge(ptr->next(edge3))); } }
/// <summary> /// ドロネー三角形に点を追加する (cvSubdiv2DLocate). /// </summary> /// <param name="pt">配置する点</param> /// <param name="edge">出力される辺.配置した点は,その辺上または端に存在する.</param> /// <param name="vertex">オプション出力.入力点と一致する細分割の頂点へのポインタのポインタ</param> /// <returns>配置する点</returns> #else /// <summary> /// Inserts a single point to Delaunay triangulation (cvSubdiv2DLocate). /// </summary> /// <param name="pt">The point to locate. </param> /// <param name="edge">The output edge the point falls onto or right to. </param> /// <param name="vertex">Optional output vertex double pointer the input point coinsides with. </param> /// <returns></returns> #endif public CvSubdiv2DPointLocation Locate(CvPoint2D32f pt, out CvSubdiv2DEdge edge, ref CvSubdiv2DPoint vertex) { return Cv.Subdiv2DLocate(this, pt, out edge, ref vertex); }
public static extern CvSubdiv2DPointLocation cvSubdiv2DLocate(IntPtr subdiv, CvPoint2D32f pt, out CvSubdiv2DEdge edge, ref IntPtr vertex);
/// <summary> /// ドロネー三角形に点を追加する (cvSubdiv2DLocate). /// </summary> /// <param name="pt">配置する点</param> /// <param name="edge">出力される辺.配置した点は,その辺上または端に存在する.</param> /// <returns>配置する点</returns> #else /// <summary> /// Inserts a single point to Delaunay triangulation (cvSubdiv2DLocate). /// </summary> /// <param name="pt">The point to locate. </param> /// <param name="edge">The output edge the point falls onto or right to. </param> /// <returns></returns> #endif public CvSubdiv2DPointLocation Locate(CvPoint2D32f pt, out CvSubdiv2DEdge edge) { return Cv.Subdiv2DLocate(this, pt, out edge); }
/// <summary> /// /// </summary> /// <param name="img"></param> /// <param name="edge"></param> private void DrawSubdivFacet(IplImage img, CvSubdiv2DEdge edge) { CvSubdiv2DEdge t = edge; int count = 0; // count number of edges in facet do { count++; t = t.GetEdge(CvNextEdgeType.NextAroundLeft); } while (t != edge); CvPoint[] buf = new CvPoint[count]; // gather points t = edge; int i; for (i = 0; i < count; i++) { CvSubdiv2DPoint pt = t.Org(); if (pt == null) { break; } buf[i] = pt.Pt; t = t.GetEdge(CvNextEdgeType.NextAroundLeft); } if (i == count) { Random rand = new Random(); CvSubdiv2DPoint pt = edge.RotateEdge(RotateEdgeFlag.Rotate).Dst(); img.FillConvexPoly(buf, CvColor.Random(), LineType.AntiAlias, 0); img.PolyLine(new CvPoint[][] { buf }, true, CvColor.Black, 1, LineType.AntiAlias, 0); DrawSubdivPoint(img, pt.Pt, CvColor.Black); } }
/// <summary> /// /// </summary> /// <param name="img"></param> /// <param name="edge"></param> /// <param name="color"></param> private void DrawSubdivEdge(IplImage img, CvSubdiv2DEdge edge, CvScalar color) { CvSubdiv2DPoint org_pt = edge.Org(); CvSubdiv2DPoint dst_pt = edge.Dst(); if (org_pt != null && dst_pt != null) { CvPoint2D32f org = org_pt.Pt; CvPoint2D32f dst = dst_pt.Pt; CvPoint iorg = new CvPoint(Cv.Round(org.X), Cv.Round(org.Y)); CvPoint idst = new CvPoint(Cv.Round(dst.X), Cv.Round(dst.Y)); //Console.WriteLine("{0} / {1}", iorg, idst); img.Line(iorg, idst, color, 1, LineType.AntiAlias, 0); } }
/// <summary> /// ドロネー三角形に点を追加する (cvSubdiv2DLocate). /// </summary> /// <param name="pt">配置する点</param> /// <param name="edge">出力される辺.配置した点は,その辺上または端に存在する.</param> /// <param name="vertex">オプション出力.入力点と一致する細分割の頂点へのポインタのポインタ</param> /// <returns>配置する点</returns> #else /// <summary> /// Inserts a single point to Delaunay triangulation (cvSubdiv2DLocate). /// </summary> /// <param name="pt">The point to locate. </param> /// <param name="edge">The output edge the point falls onto or right to. </param> /// <param name="vertex">Optional output vertex double pointer the input point coinsides with. </param> /// <returns></returns> #endif public CvSubdiv2DPointLocation Locate(CvPoint2D32f pt, out CvSubdiv2DEdge edge, ref CvSubdiv2DPoint vertex) { return(Cv.Subdiv2DLocate(this, pt, out edge, ref vertex)); }
/// <summary> /// ドロネー三角形に点を追加する (cvSubdiv2DLocate). /// </summary> /// <param name="pt">配置する点</param> /// <param name="edge">出力される辺.配置した点は,その辺上または端に存在する.</param> /// <returns>配置する点</returns> #else /// <summary> /// Inserts a single point to Delaunay triangulation (cvSubdiv2DLocate). /// </summary> /// <param name="pt">The point to locate. </param> /// <param name="edge">The output edge the point falls onto or right to. </param> /// <returns></returns> #endif public CvSubdiv2DPointLocation Locate(CvPoint2D32f pt, out CvSubdiv2DEdge edge) { return(Cv.Subdiv2DLocate(this, pt, out edge)); }