// create new vertex list 
// new vertex has same type with old vertex.
// new edge vertex has same type with old edge, such as inner, ordinary and crease
// new face vertex has same type with old face, such as inner, (ordinary) border
// new cell vertex only has INNER type
void hs_subdiv::create_vert_list(hs_model* pmodel
								 , point_vector& vert_points
								 , point_vector& edge_points
								 , point_vector& face_points
								 , point_vector& cell_points
								 ) 
{
	point_vector_iter vert_iter;
	size_t idx = 0;
	vert_iter = vert_points.begin();
	for (; vert_iter != vert_points.end(); ++vert_iter, ++idx) {
		pmodel->add_vert(*vert_iter, phexmodel->vert_at(idx).type() );
	}
	
	idx = 0;
	vert_iter = edge_points.begin();
	for (; vert_iter != edge_points.end(); ++vert_iter, ++idx) {
		pmodel->add_vert(*vert_iter, 
			static_cast<vert_type>( phexmodel->edge_at(idx).type() ));
	}
	
	idx = 0;
	vert_iter = face_points.begin();
	for (; vert_iter != face_points.end(); ++vert_iter, ++idx) {
		pmodel->add_vert(*vert_iter,
			static_cast<vert_type>( phexmodel->face_at(idx).type() ) );
	}
	
	vert_iter = cell_points.begin();
	for (; vert_iter != cell_points.end(); ++vert_iter) {
		pmodel->add_vert(*vert_iter, INNER_VERT);
	}
	
}
예제 #2
0
파일: boundary.cpp 프로젝트: caomw/mods
  /*----------------------------------------------------------------*/
  static void ConnectedComponent(unsigned char thresh, int marker, point_vector &inside, point_vector &boundary)
  {
    // simple connected component
    while (!inside.empty())
      {
        t_offset ofs = inside.back().ofs;
        inside.pop_back();
        add_if_inside(inside, boundary, thresh, ofs + g_cols, 4, marker);
        add_if_inside(inside, boundary, thresh, ofs - g_cols, 1, marker);
        add_if_inside(inside, boundary, thresh, ofs + 1,      2, marker);
        add_if_inside(inside, boundary, thresh, ofs - 1,      8, marker);
      }

    /* sort region's boundary */
    std::sort(boundary.begin(), boundary.end());
  }