Ejemplo n.º 1
0
/*----------------------------------------------------------------------*
 |  compute the overlap (public)                             mwgee 10/05|
 *----------------------------------------------------------------------*/
bool MOERTEL::Overlap::ComputeOverlap()
{
  bool ok = false;

  ok = QuickOverlapTest();
  if (!ok)
  {
    //if (foundit) std::cout << "QuickOverlapTest NOT passed\n";
    return false;
  }

  // project master nodes onto slave segment if not already done
  if (!havemxi_)
    havemxi_ = build_mxi();
  // perform a quick test


  // build array of local sxi coords of nodes
  havesxi_ = build_sxi();

  // project slave nodes onto master segment
  havesxim_ = build_sxim();
  
  // build outward normal of edges of sseg (in local coords)
  build_normal();
  
  // compute information about the edges of the slave/master triangle
  // in slave triangle coord system
  if (!havelines_)
    havelines_ = build_lines_s();

  // compute information about the edges of the slave/master triangle
  // in master triangle coord system
  if (!havelinem_)
    havelinem_ = build_lines_m();

  // perform clipping algorithm
  ok = Clipelements();
  
  if (!ok)
    return false;
  
  // make a triangulation of the overlap polygon
  ok = Triangulation();
  if (!ok)
    return false;

  return true;
}
Ejemplo n.º 2
0
/*----------------------------------------------------------------------*
 |  compute the overlap (public)                             mwgee 10/05|
 *----------------------------------------------------------------------*/
bool MOERTEL::Overlap::ComputeOverlap() {

  // Returning false means there is no overlap between mseg and sseg

  bool ok = false;

  // If we pass the quick overlap test, that means that the master and slave segments are close
  // enough to each other that they could interact. 

  ok = QuickOverlapTest();

  if (!ok)
  {
    return false; // cannot interact
  }

  // project master nodes onto slave segment if not already done
  // The master nodes that define the master segment are projected into the slave
  // segment using:
  //  ProjectNodetoSegment_SegmentNormal(*mnode[i],sseg_,mxi_[i],gap);

  if (!havemxi_)
    havemxi_ = build_mxi();

  // build array of local sxi coords of nodes
  // These do not need to be projected as they are the coords of the slave nodes in the
  // slave segment

  havesxi_ = build_sxi();

  // project slave nodes onto master segment
  // These nodal coordinates are projected from the slave segment into the master, using
  //  ProjectNodetoSegment_NodalNormal(*snode[i],mseg_,sxim_[i],gap);

  havesxim_ = build_sxim();
  
  // build outward normal of edges of sseg (in local coords)
  build_normal();
  
  // compute information about the edges of the slave/master polygons
  // in slave polygon coord system

  if (!havelines_)
    havelines_ = build_lines_s();

  // compute information about the edges of the slave/master polygons
  // in master polygon coord system
  if (!havelinem_)
    havelinem_ = build_lines_m();

  // perform clipping algorithm
  // If this returns false, it means that there is no effective overlap between the master and slave
  // segments
  
//  ok = Clipelements();
  ok = ClipelementsSH(); // Use Sutherland-Hodgman algorithm
  
  if (!ok)
    return false;
  
  // make a triangulation of the overlap polygon
  ok = Triangulation();
  if (!ok)
    return false;

  return true;
}