Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

These two vertex indices form the current edge that tested against

// Do polys intersect
if ( !CCollision::AABBIntersectAABB( SrcMin,
DestMax ) ) continue;

// Repair against the testing poly
RepairTJunctions( pCurrentPoly, pTestPoly );

catch ( ... )
// Clean up and return (failure)
return false;

} // End Catch Block


The function begins by setting up a loop to iterate through every edge in the polygon. The loop will step through each vertex and the vertex ahead of it in the array for the edge that is currently being tested.

void CBaseTree::RepairTJunctions( CPolygon * pPoly1, CPolygon * pPoly2 )


// For each edge of this face
for ( v1 = 0; v1 < pPoly1->m_nVertexCount; v1++ ) {
// Retrieve the next edge vertex (wraps to 0) v2 = ((v1 + 1) % pPoly1->m_nVertexCount);

// Store verts (Required because indices may change) Vert1 = pPoly1->m_pVertex[v1];
Vert2 = pPoly1->m_pVertex[v2];

In this next code block we repair the T-junction. This is done by simply inserting a new vertex in the polygon immediately after the first vertex in the edge we are testing (v1). That is, we must insert it at the position in the vertex array currently occupied by the second vertex v2. This will nudge all vertices in the winding order up by one position in the array, creating the current edge between v1 and the new vertex we have just inserted. It also adds a new edge to the polygon between the new vertex and what used to be the second vertex in the current edge.


How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
PageId: ELIC566EFB
Uploaded by :
Page 1 Preview
these two vertex indices form the current edge tha
Sell Your Old Documents & Earn Wallet Balance