MCPcopy Create free account
hub / github.com/carbonengine/trinity / OverlapTest

Function OverlapTest

trinity/Eve/UI/EveSpherePinIndexTree.cpp:316–351  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

314
315// ------------------------------------------------------------------------------------------------------
316int OverlapTest( EveSpherePinIndexTree::TreeNode* n, EveSpherePinIndexTree::Face* f, std::vector<Vector2>& vertices )
317{
318 float maxTheta = max( vertices[f->index1].x, max( vertices[f->index2].x, vertices[f->index3].x ) );
319 float minTheta = min( vertices[f->index1].x, min( vertices[f->index2].x, vertices[f->index3].x ) );
320 float maxPhi = max( vertices[f->index1].y, max( vertices[f->index2].y, vertices[f->index3].y ) );
321 float minPhi = min( vertices[f->index1].y, min( vertices[f->index2].y, vertices[f->index3].y ) );
322
323 if( ( maxPhi - minPhi ) > XM_PI )
324 {
325 float temp = minPhi;
326 minPhi = maxPhi;
327 maxPhi = temp + 2 * XM_PI;
328 }
329
330 int phiOverlap = 0;
331 if( minPhi < n->phiMin && maxPhi > n->phiMin )
332 {
333 phiOverlap = 1;
334 }
335 else if( minPhi < n->phiMax && minPhi >= n->phiMin )
336 {
337 phiOverlap = 1;
338 }
339
340 int thetaOverlap = 0;
341 if( minTheta < n->thetaMin && maxTheta > n->thetaMin )
342 {
343 thetaOverlap = 1;
344 }
345 else if( minTheta < n->thetaMax && minTheta >= n->thetaMin )
346 {
347 thetaOverlap = 1;
348 }
349
350 return thetaOverlap && phiOverlap;
351}
352
353// ------------------------------------------------------------------------------------------------------
354int OverlapTest( EveSpherePinIndexTree::TreeNode* n, float minTheta, float maxTheta, float minPhi, float maxPhi )

Callers 2

AddFaceToTreeFunction · 0.85
MarkFacesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected