当前位置: 首页>>代码示例>>C++>>正文


C++ GetEdge函数代码示例

本文整理汇总了C++中GetEdge函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEdge函数的具体用法?C++ GetEdge怎么用?C++ GetEdge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetEdge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetNode

void TNEANet::DelNode(const int& NId) {
  int i;
  
  const TNode& Node = GetNode(NId);
  for (int out = 0; out < Node.GetOutDeg(); out++) {
    const int EId = Node.GetOutEId(out);
    const TEdge& Edge = GetEdge(EId);
    IAssert(Edge.GetSrcNId() == NId);
    GetNode(Edge.GetDstNId()).InEIdV.DelIfIn(EId);
    EdgeH.DelKey(EId);
    // Delete from Edge Attributes
    for (i = 0; i < VecOfIntVecsE.Len(); i++) {
      TVec<TInt>& IntVec = VecOfIntVecsE[i];
      IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
    }
    for (i = 0; i < VecOfStrVecsE.Len(); i++) {
      TVec<TStr>& StrVec = VecOfStrVecsE[i];
      StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
    }
    for (i = 0; i < VecOfFltVecsE.Len(); i++) {
      TVec<TFlt>& FltVec = VecOfFltVecsE[i];
      FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
    }
  }
  for (int in = 0; in < Node.GetInDeg(); in++) {
    const int EId = Node.GetInEId(in);
    const TEdge& Edge = GetEdge(EId);
    IAssert(Edge.GetDstNId() == NId);
    GetNode(Edge.GetSrcNId()).OutEIdV.DelIfIn(EId);
    EdgeH.DelKey(EId);
    // Delete from Edge Attributes
    for (i = 0; i < VecOfIntVecsE.Len(); i++) {
      TVec<TInt>& IntVec = VecOfIntVecsE[i];
      IntVec.Ins(EdgeH.GetKeyId(EId), TInt::Mn);
    }
    for (i = 0; i < VecOfStrVecsE.Len(); i++) {
      TVec<TStr>& StrVec = VecOfStrVecsE[i];
      StrVec.Ins(EdgeH.GetKeyId(EId), TStr::GetNullStr());
    }
    for (i = 0; i < VecOfFltVecsE.Len(); i++) {
      TVec<TFlt>& FltVec = VecOfFltVecsE[i];
      FltVec.Ins(EdgeH.GetKeyId(EId), TFlt::Mn);
    }
  }

  for (i = 0; i < VecOfIntVecsN.Len(); i++) {
    TVec<TInt>& IntVec = VecOfIntVecsN[i];
    IntVec.Ins(NodeH.GetKeyId(NId), TInt::Mn);
  }
  for (i = 0; i < VecOfStrVecsN.Len(); i++) {
    TVec<TStr>& StrVec = VecOfStrVecsN[i];
    StrVec.Ins(NodeH.GetKeyId(NId), TStr::GetNullStr());
  }
  for (i = 0; i < VecOfFltVecsN.Len(); i++) {
    TVec<TFlt>& FltVec = VecOfFltVecsN[i];
    FltVec.Ins(NodeH.GetKeyId(NId), TFlt::Mn);
  }
  NodeH.DelKey(NId);
}
开发者ID:JLiangWaterloo,项目名称:sat,代码行数:59,代码来源:network.cpp

示例2: IAssert

void TNEGraph::DelEdge(const int& EId) {
  IAssert(IsEdge(EId));
  const int SrcNId = GetEdge(EId).GetSrcNId();
  const int DstNId = GetEdge(EId).GetDstNId();
  GetNode(SrcNId).OutEIdV.DelIfIn(EId);
  GetNode(DstNId).InEIdV.DelIfIn(EId);
  EdgeH.DelKey(EId);
}
开发者ID:SherlockYang,项目名称:Archive,代码行数:8,代码来源:graph.cpp

示例3: ExtractTheOneSelectedQtEdge

void ribi::cmap::QtConceptMap::CheckInvariants() const noexcept
{
  #ifndef NDEBUG

  //If there is one QtEdge selected, its Edge must be able to been found
  try
  {
    const auto qtedge = ExtractTheOneSelectedQtEdge(*GetScene());
    //The QtEdge its edge must be in the concept map
    //Can only compare IDs, as QtEdge::GetEdge() and its equivalent in the concept map may mismatch
    assert(
      has_custom_edge_with_my_edge(
        qtedge->GetEdge(), GetConceptMap(), [](const Edge& lhs, const Edge& rhs) { return lhs.GetId() == rhs.GetId(); }
      )
    );
    const auto edge = ExtractTheOneSelectedEdge(this->GetConceptMap(), *GetScene());
    assert(qtedge->GetEdge().GetId() == edge.GetId());
  }
  catch (...) {} //No problem

  //All QtNodes must have a scene
  {
    const auto qtnodes = GetQtNodes(scene());
    for (const auto qtnode: qtnodes)
    {
      assert(qtnode);
      assert(qtnode->scene());
    }
  }

  //All QtEdges, their QtNodes and Arrows must have a scene
  {
    const auto qtedges = GetQtEdges(scene());
    for (const auto qtedge: qtedges)
    {
      assert(qtedge);
      assert(qtedge->scene());
      assert(qtedge->GetArrow());
      assert(qtedge->GetArrow()->scene());
      assert(qtedge->GetQtNode());
      assert(qtedge->GetQtNode()->scene());
      assert(qtedge->GetFrom());
      assert(qtedge->GetFrom()->scene());
      assert(qtedge->GetTo());
      assert(qtedge->GetTo()->scene());
    }
  }

  #endif
}
开发者ID:richelbilderbeek,项目名称:RibiClasses,代码行数:50,代码来源:qtconceptmap.cpp

示例4: AdjacentNode

int AdjacentNode(graph *g, int FromNode, int index)
{
	edge *retEdge = GetEdge(g, FromNode, index);
	
	if(retEdge == NULL) return -1;
	else return retEdge->to;
}
开发者ID:thiagovas,项目名称:AEDSIII-TPI,代码行数:7,代码来源:graph.c

示例5: ValueFromEdge

int ValueFromEdge(graph *g, int FromNode, int index)
{
	edge *retEdge = GetEdge(g, FromNode, index);
	
	if(retEdge == NULL) return -1;
	else return retEdge->value;
}
开发者ID:thiagovas,项目名称:AEDSIII-TPI,代码行数:7,代码来源:graph.c

示例6: CostFromEdge

double CostFromEdge(graph *g, int FromNode, int index)
{
	edge *retEdge = GetEdge(g, FromNode, index);
	
	if(retEdge == NULL) return -1;
	else return retEdge->cost;
}
开发者ID:thiagovas,项目名称:AEDSIII-TPI,代码行数:7,代码来源:graph.c

示例7: WriteFace

/*
==================
WriteFace
==================
*/
void WriteFace (face_t *f)
{
	dface_t	*df;
	int		i;
	int		e;

	f->outputnumber = numfaces;

	df = &dfaces[numfaces];
	if (numfaces >= MAX_MAP_FACES)
		Error ("numfaces == MAX_MAP_FACES");
	numfaces++;

	df->planenum = f->planenum & (~1);
	df->side = f->planenum & 1;
	df->firstedge = numsurfedges;
	df->numedges = f->numpoints;
	df->texinfo = f->texturenum;
	for (i=0 ; i<f->numpoints ; i++)
	{
		e = GetEdge (f->pts[i], f->pts[(i+1)%f->numpoints], f);
		if (numsurfedges >= MAX_MAP_SURFEDGES)
			Error ("numsurfedges == MAX_MAP_SURFEDGES");
		dsurfedges[numsurfedges] = e;
		numsurfedges++;
	}
}
开发者ID:6779660,项目名称:halflife,代码行数:32,代码来源:writebsp.c

示例8: NumEdges

//
// try to guess type of roof from looking at slopes of edges of
// this level
//
RoofType vtLevel::GuessRoofType()
{
	int sloped = 0, vert = 0, hori = 0;
	int i, edges = NumEdges();
	for (i = 0; i < edges; i++)
	{
		vtEdge *edge = GetEdge(i);
		if (edge->m_iSlope == 0)
			hori++;
		else if (edge->m_iSlope == 90)
			vert++;
		else
			sloped++;
	}
	if (hori)
		return ROOF_FLAT;

	if (sloped == 1 && vert == edges-1)
		return ROOF_SHED;

	if (sloped == edges)
		return ROOF_HIP;

	if (sloped > 0 && vert > 0)
		return ROOF_GABLE;

	return ROOF_UNKNOWN;
}
开发者ID:kalwalt,项目名称:ofxVTerrain,代码行数:32,代码来源:Building.cpp

示例9: EmitFace

/**
 * @sa EmitDrawNode_r
 * @note Called for every node face
 */
static void EmitFace (const face_t* f)
{
	dBspSurface_t* df;
	int i;

	if (f->numpoints < 3) {
		return;		/* degenerated */
	}
	if (f->merged || f->split[0] || f->split[1]) {
		return;		/* not a final face */
	}

	if (curTile->numfaces >= MAX_MAP_FACES)
		Sys_Error("numfaces >= MAX_MAP_FACES (%i)", curTile->numfaces);
	df = &curTile->faces[curTile->numfaces];
	curTile->numfaces++;

	df->planenum = f->planenum & (~1);
	df->side = f->planenum & 1;

	df->firstedge = curTile->numsurfedges;
	df->numedges = f->numpoints;
	df->texinfo = f->texinfo;
	for (i = 0; i < f->numpoints; i++) {
		const int e = GetEdge(f->vertexnums[i], f->vertexnums[(i + 1) % f->numpoints], f);
		if (curTile->numsurfedges >= MAX_MAP_SURFEDGES)
			Sys_Error("numsurfedges >= MAX_MAP_SURFEDGES (%i)", curTile->numsurfedges);
		curTile->surfedges[curTile->numsurfedges] = e;
		curTile->numsurfedges++;
	}
	for (i = 0; i < LIGHTMAP_MAX; i++)
		df->lightofs[i] = -1;
}
开发者ID:Isaacssv552,项目名称:ufoai,代码行数:37,代码来源:writebsp.cpp

示例10: GetLinkModel

void touchmind::view::linkedge::impl::ArrowLinkEdgeView::CreateDeviceDependentResources(
    touchmind::Context *pContext, ID2D1RenderTarget *pRenderTarget) {
  if (GetLinkModel().expired()) {
    return;
  }
  auto link = GetLinkModel().lock();
  if (!link->IsValid()) {
    return;
  }
  auto linkEdge = link->GetEdge(GetEdgeId());
  auto node = link->GetNode(GetEdgeId());
  if (linkEdge->IsRepaintRequired(GetRepaintCounter()) || m_pArrowGeometry == nullptr || m_pBrush == nullptr) {
    ID2D1Factory *pD2DFactory = pContext->GetD2DFactory();

    D2D1_POINT_2F point0 = link->GetEdgePoint(GetEdgeId());
    std::vector<D2D1_POINT_2F> points;
    view::GeometryBuilder::CalculateArrowPoints(point0, linkEdge->GetMarkerSize() + link->GetLineWidth(),
                                                linkEdge->GetMarkerSize() + link->GetLineWidth(), linkEdge->GetAngle(),
                                                node->GetAncestorPosition(), points);
    m_pArrowGeometry = nullptr;
    CHK_RES(m_pArrowGeometry,
            view::GeometryBuilder::CreatePathGeometryFromPoints(pD2DFactory, points, &m_pArrowGeometry));

    m_pBrush = nullptr;
    CHK_RES(m_pBrush, pRenderTarget->CreateSolidColorBrush(link->GetLineColor(), D2D1::BrushProperties(), &m_pBrush));
    SetRepaintCounter(linkEdge);
  }
}
开发者ID:yohei-yoshihara,项目名称:TouchMind,代码行数:28,代码来源:ArrowLinkEdgeView.cpp

示例11: GetNode

bool TNEGraph::IsEdge(const int& SrcNId, const int& DstNId, int& EId, const bool& Dir) const {
  const TNode& SrcNode = GetNode(SrcNId);
  for (int edge = 0; edge < SrcNode.GetOutDeg(); edge++) {
    const TEdge& Edge = GetEdge(SrcNode.GetOutEId(edge));
    if (DstNId == Edge.GetDstNId()) {
      EId = Edge.GetId();  return true; }
  }
  if (! Dir) {
    for (int edge = 0; edge < SrcNode.GetInDeg(); edge++) {
    const TEdge& Edge = GetEdge(SrcNode.GetInEId(edge));
    if (DstNId == Edge.GetSrcNId()) {
      EId = Edge.GetId();  return true; }
    }
  }
  return false;
}
开发者ID:SherlockYang,项目名称:Archive,代码行数:16,代码来源:graph.cpp

示例12: GetNSegments

float PolyLine2::Distance( const PolyLine2& p ) const
{
    int nSA = GetNSegments();
    int nSB = p.GetNSegments();
    if (nSA == 0 || nSB == 0) return 0.0f;
    float res = GetEdge( 0 ).dist2( p.GetEdge( 0 ) );

    for (int i = 0; i < nSA; i++)
    {
        for (int j = 0; j < nSB; j++)
        {
            float cDist = GetEdge( i ).dist2( p.GetEdge( j ) );
            if (cDist < res) res = cDist;
        }
    }
    return sqrtf( res );
}
开发者ID:skopp,项目名称:rush,代码行数:17,代码来源:polyline2.cpp

示例13: assert

void ribi::cmap::QtEdge::OnTextChanged(QtRoundedEditRectItem* item) noexcept
{
  assert(!"Am I called?");
  const auto new_name = item->GetText()[0];
  const auto old_name = GetEdge().GetNode().GetConcept().GetName();
  if (old_name != new_name)
  {
    this->GetEdge().GetNode().GetConcept().SetName(new_name);
  }
}
开发者ID:richelbilderbeek,项目名称:RibiClasses,代码行数:10,代码来源:qtconceptmapqtedge.cpp

示例14: ASSERT

CMesh::TTriangle *CMesh::AddTriangle(TVertex *pVert0, TVertex *pVert1, TVertex *pVert2, int iIndex)
{
  ASSERT(m_hashVertices.Find(pVert0) && m_hashVertices.Find(pVert1) && m_hashVertices.Find(pVert2));

#ifdef _DEBUG
  {
  TTriangle kTestTri(pVert0, pVert1, pVert2);
  TTriangleHash::TIter it = m_hashTriangles.Find(&kTestTri);
  ASSERT(!it);

  CVector<3> vNormal = kTestTri.GetNormal();
  float fArea = vNormal.Length();
  ASSERT(fArea > 0.25);
  float fEdgeLen = Util::Max((pVert0->m_vCoord - pVert1->m_vCoord).Length(), 
                             Util::Max((pVert1->m_vCoord - pVert2->m_vCoord).Length(), 
                                       (pVert2->m_vCoord - pVert0->m_vCoord).Length()));
  ASSERT(fEdgeLen * fEdgeLen / fArea < MAX_ELONGATION);
  }
#endif

  TTriangle *pTri = new TTriangle(pVert0, pVert1, pVert2);
  if (iIndex >= 0)
    pTri->m_iIndex = iIndex;
  else
    pTri->m_iIndex = m_hashTriangles.m_iCount;
  m_hashTriangles.Add(pTri);

  pVert0->AddTriangle(pTri);
  pVert1->AddTriangle(pTri);
  pVert2->AddTriangle(pTri);

  TEdge *pEdge0, *pEdge1, *pEdge2;
  pEdge0 = GetEdge(pVert0, pVert1, true);
  pEdge0->AddTriangle(pTri);
  pEdge1 = GetEdge(pVert1, pVert2, true);
  ASSERT(pEdge1 != pEdge0);
  pEdge1->AddTriangle(pTri);
  pEdge2 = GetEdge(pVert2, pVert0, true);
  ASSERT(pEdge2 != pEdge1 && pEdge2 != pEdge0);
  pEdge2->AddTriangle(pTri);

  return pTri;
}
开发者ID:aaalexandrov,项目名称:Alex,代码行数:43,代码来源:Mesh.cpp

示例15:

void touchmind::model::node::NodeModel::UpdateLinkStatus_SaveRequired() {
  std::for_each(m_links.begin(), m_links.end(), [](std::weak_ptr<touchmind::model::link::LinkModel> _link) {
    if (!_link.expired()) {
      auto link = _link.lock();
      link->IncrementSaveRequiredCounter();
      link->GetEdge(EDGE_ID_1)->IncrementSaveRequiredCounter();
      link->GetEdge(EDGE_ID_2)->IncrementSaveRequiredCounter();
    }
  });
}
开发者ID:yohei-yoshihara,项目名称:TouchMind,代码行数:10,代码来源:NodeModel.cpp


注:本文中的GetEdge函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。