MCPcopy Create free account
hub / github.com/creatale/node-dv / insert

Method insert

deps/opencv/modules/imgproc/src/subdivision2d.cpp:410–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408
409
410int Subdiv2D::insert(Point2f pt)
411{
412 int curr_point = 0, curr_edge = 0, deleted_edge = 0;
413 int location = locate( pt, curr_edge, curr_point );
414
415 if( location == PTLOC_ERROR )
416 CV_Error( CV_StsBadSize, "" );
417
418 if( location == PTLOC_OUTSIDE_RECT )
419 CV_Error( CV_StsOutOfRange, "" );
420
421 if( location == PTLOC_VERTEX )
422 return curr_point;
423
424 if( location == PTLOC_ON_EDGE )
425 {
426 deleted_edge = curr_edge;
427 recentEdge = curr_edge = getEdge( curr_edge, PREV_AROUND_ORG );
428 deleteEdge(deleted_edge);
429 }
430 else if( location == PTLOC_INSIDE )
431 ;
432 else
433 CV_Error_(CV_StsError, ("Subdiv2D::locate returned invalid location = %d", location) );
434
435 assert( curr_edge != 0 );
436 validGeometry = false;
437
438 curr_point = newPoint(pt, false);
439 int base_edge = newEdge();
440 int first_point = edgeOrg(curr_edge);
441 setEdgePoints(base_edge, first_point, curr_point);
442 splice(base_edge, curr_edge);
443
444 do
445 {
446 base_edge = connectEdges( curr_edge, symEdge(base_edge) );
447 curr_edge = getEdge(base_edge, PREV_AROUND_ORG);
448 }
449 while( edgeDst(curr_edge) != first_point );
450
451 curr_edge = getEdge( base_edge, PREV_AROUND_ORG );
452
453 int i, max_edges = (int)(qedges.size()*4);
454
455 for( i = 0; i < max_edges; i++ )
456 {
457 int temp_dst = 0, curr_org = 0, curr_dst = 0;
458 int temp_edge = getEdge( curr_edge, PREV_AROUND_ORG );
459
460 temp_dst = edgeDst( temp_edge );
461 curr_org = edgeOrg( curr_edge );
462 curr_dst = edgeDst( curr_edge );
463
464 if( isRightOf( vtx[temp_dst].pt, curr_edge ) > 0 &&
465 isPtInCircle3( vtx[curr_org].pt, vtx[temp_dst].pt,
466 vtx[curr_dst].pt, vtx[curr_point].pt ) < 0 )
467 {

Callers

nothing calls this directly

Calls 3

isPtInCircle3Function · 0.85
insertFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected