Ejemplo n.º 1
0
void
AATPoint::update_deadzone(const TaskProjection &projection)
{
  // deadzone must be updated

  assert(get_next());
  assert(get_previous());
  
  // the deadzone is the convex hull formed from the sampled points
  // with the inclusion of all points on the boundary closer than
  // the max double distance to the sample polygon
  
  m_deadzone = SearchPointVector(get_sample_points().begin(),
                                 get_sample_points().end());

  // do nothing if no samples (could happen if not achieved properly)
  if (m_deadzone.empty())
    return;

  // previous and next targets
  const SearchPoint pnext(get_next()->get_location_remaining(),
                          projection);
  const SearchPoint pprevious(get_previous()->get_location_remaining(),
                              projection);

  // find max distance
  unsigned dmax = 0;
  for (SearchPointVector::const_iterator it = get_sample_points().begin();
       it != get_sample_points().end(); ++it) {
    unsigned dd = pnext.flat_distance(*it) + pprevious.flat_distance(*it);
    dmax = std::max(dd, dmax);
  }

  // now add boundary points closer than dmax
  const SearchPointVector& boundary = get_boundary_points();
  for (SearchPointVector::const_iterator it = boundary.begin();
       it != boundary.end(); ++it) {
    unsigned dd = pnext.flat_distance(*it) + pprevious.flat_distance(*it);
    if (dd< dmax)
      m_deadzone.push_back(*it);
  }

  // convert to convex polygon
  prune_interior(m_deadzone);
}
Ejemplo n.º 2
0
const Vector2f* AP_Proximity::get_boundary_points(uint16_t& num_points) const
{
    return get_boundary_points(primary_instance, num_points);
}
Ejemplo n.º 3
0
//-------------------------------------------------------------------------
// Purpose       : facet_surface: facets the surface.
//
// Special Notes : 
//
// Creator       : David White
//
// Creation Date : 03/01/02
//-------------------------------------------------------------------------
CubitStatus Faceter::facet_surface(DLIList <CubitFacet*> &results,
                                   DLIList <CubitPoint*> &point_list)
{
  if ( DEBUG_FLAG(129) )
  {
    GfxDebug::clear();
    GfxDebug::draw_ref_face_edges(thisRefFacePtr);
    GfxDebug::flush();
    int debug = 0;
    if ( debug )
    {
      GfxDebug::mouse_xforms();
      GfxDebug::flush();
    }
  }
  if ( thisRefFacePtr->number_of_Loops() > 1 )
    return CUBIT_FAILURE;
    //Get the ordered boundary loops.
  int ii, jj;
  DLIList <DLIList<CubitPoint*>*>  boundary_point_loops;
  DLIList <CubitPoint*> *tmp_list_ptr;
  CubitStatus stat = get_boundary_points( boundary_point_loops );
  if ( stat != CUBIT_SUCCESS )
  {
      //clean up the data...
    for ( ii = boundary_point_loops.size(); ii > 0; ii-- )
    {
      tmp_list_ptr = boundary_point_loops.pop();
      for ( jj = tmp_list_ptr->size(); jj > 0; jj-- )
        delete tmp_list_ptr->pop();
      delete tmp_list_ptr;
    }
    return stat;
  }
    //Set up the gridsearch.
  double ratio = gridCellScale, cell_size = 0.0;
  max_min_edge_ratio(boundary_point_loops, ratio, cell_size);
  if (ratio <= gridCellScale) {
    ratio = gridCellScale;
  }
    //Get all of the points into a single list.
  for ( ii = boundary_point_loops.size(); ii > 0; ii-- )
  {
    tmp_list_ptr = boundary_point_loops.get_and_step();
    for ( jj = tmp_list_ptr->size(); jj > 0; jj-- )
    {
      globalPointList->append(tmp_list_ptr->get_and_step());
    }
  }
  gridSearchPtr = new PointGridSearch(*globalPointList,
                                      cell_size,
                                      ratio);
      //fill in the grid...
  for ( ii = globalPointList->size(); ii > 0; ii-- )
    gridSearchPtr->add_point(globalPointList->get_and_step());

    //Now start faceting.
  stat = facet_loop( boundary_point_loops.get(), results );
    //clean up the data...
  for ( ii = boundary_point_loops.size(); ii > 0; ii-- )
    delete boundary_point_loops.pop();
  if ( stat != CUBIT_SUCCESS )
  {
      //clean the data and return..
    for ( ii = results.size(); ii > 0; ii-- )
      delete results.pop();
    for ( ii = globalPointList->size(); ii > 0; ii-- )
      delete globalPointList->pop();
    return stat;
  }
    //Didn't add any points...
  point_list += *globalPointList;
  return CUBIT_SUCCESS;
}