Esempio n. 1
0
void csStencilShadowCacheEntry::HandlePoly (const csVector3* vertices, 
                                            const int* polyVertices, 
                                            const int numVerts,
                                            csArray<EdgeInfo>& edge_array, 
                                            csHash<EdgeInfo*>& edge_stack,
                                            int& NextEdge, int& TriIndex)
{
  EdgeInfo *e = &edge_array[NextEdge ++];
  e->a = vertices[polyVertices[0]];
  e->b = vertices[polyVertices[1]];
  e->ind_a = TriIndex + 0;
  e->ind_b = TriIndex + 1;
  HandleEdge (e, edge_stack);

  /* if the polygon is just a triangle this happens once
      and the net result is that each edge is handled explicitly */
  for (int j = 2; j < numVerts; j ++) 
  {
    EdgeInfo *e = &edge_array[NextEdge ++];
    e->a = vertices[polyVertices[j - 1]];
    e->b = vertices[polyVertices[j]];
    e->ind_a = TriIndex + 1;
    e->ind_b = TriIndex + 2;
    HandleEdge (e, edge_stack);
    TriIndex += 3;
  }

  e = &edge_array[NextEdge ++];
  e->a = vertices[polyVertices[numVerts - 1]];
  e->b = vertices[polyVertices[0]];
  e->ind_a = TriIndex - 1; /* TriIndex + 2 from previous triangle */
  e->ind_b = TriIndex - 3; /* TriIndex + 0 from previous triangle */
  HandleEdge (e, edge_stack);
}
	void Delaunay::TrianglesToEdges(const TriangleSet& triangles, EdgeSet& edges)
	{
		for (cTriangleIterator iter = triangles.begin(); iter != triangles.end(); ++iter)
		{
			HandleEdge(iter->GetVertex(0), iter->GetVertex(1), edges);
			HandleEdge(iter->GetVertex(1), iter->GetVertex(2), edges);
			HandleEdge(iter->GetVertex(2), iter->GetVertex(0), edges);
		}
	}
Esempio n. 3
0
void Delaunay::TrianglesToEdges(const triangleSet& triangles, edgeSet& edges)
{
	for (ctIterator it = triangles.begin(); it != triangles.end(); ++it)
	{
		HandleEdge(it->GetVertex(0), it->GetVertex(1), edges);
		HandleEdge(it->GetVertex(1), it->GetVertex(2), edges);
		HandleEdge(it->GetVertex(2), it->GetVertex(0), edges);
	}
}
Esempio n. 4
0
	bool operator()(const triangle& tri) const
	{
		bool b = tri.CCEncompasses(m_itVertex);

		if (b)
		{
			HandleEdge(tri.GetVertex(0), tri.GetVertex(1));
			HandleEdge(tri.GetVertex(1), tri.GetVertex(2));
			HandleEdge(tri.GetVertex(2), tri.GetVertex(0));
		}
		return b;
	}