当前位置: 首页>>代码示例>>C++>>正文


C++ Vertices类代码示例

本文整理汇总了C++中Vertices的典型用法代码示例。如果您正苦于以下问题:C++ Vertices类的具体用法?C++ Vertices怎么用?C++ Vertices使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Vertices类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: device_

Sphere::Sphere( float radius, unsigned tesselationLevel, D3D::GraphicDevice device, float freq,
			    const Material& material )
	: device_(device),
	  vertexDeclaration_(device, DefaultVertexDeclaration),
	  vertexBuffer_(device),
	  indexBuffer_(device),
	  shader_(device, L"sphere.vsh"),
	  radius_(radius),
	  tesselationLevel_(tesselationLevel),
	  freq_(freq),
	  material_(material)
{
	Vertices vertices;
	Indices indices;

	InitVertices(tesselationLevel, radius*sqrtf(2), vertices, indices);
	nVertices_ = vertices.size();
	nPrimitives_ = indices.size()/3;
	vertexBuffer_.SetVertices( &vertices[0], vertices.size() );
	indexBuffer_.SetIndices( &indices[0], indices.size() );
	SetPositionMatrix( UnityMatrix() );
	SetViewMatrix( UnityMatrix() );
	SetProjectiveMatrix( UnityMatrix() );
}
开发者ID:eas,项目名称:Lighting,代码行数:24,代码来源:sphere.cpp

示例2: color_sort

	void color_sort(Vertices &R){
		int j = 0, maxno = 1, min_k = max((int)QMAX.size() - (int)Q.size() + 1, 1);
		C[1].clear(), C[2].clear();
		for(int i = 0; i < (int)R.size(); i++) {
			int pi = R[i].i, k = 1;
			while(cut1(pi, C[k])) k++;
			if(k > maxno) maxno = k, C[maxno + 1].clear();
			C[k].push_back(pi);
			if(k < min_k) R[j++].i = pi;
		}
		if(j > 0) R[j - 1].d = 0;
		for(int k = min_k; k <= maxno; k++)
			for(int i = 0; i < (int)C[k].size(); i++)
				R[j].i = C[k][i], R[j++].d = k;
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:15,代码来源:MaximumClique.cpp

示例3:

bool SpatialModelMaximalRepulsion3D<CoordType>::checkHardcoreDistances(
  const Vector<CoordType>& vertex,
  const int v,
  const Vertices<CoordType>& vertices) const
{
  const Vector<CoordType>& hardcoreDistances = this->getHardcoreDistances();
  Vector<CoordType> triMeshVertex;
  if ( this->getTriMeshQuery().closestPoint(vertex,triMeshVertex) < hardcoreDistances[v] )
    return false;

  for (int i = 0; i < vertices.getNumVertices(); ++i)
    if ( i != v && vertices[i].distance(vertex) < hardcoreDistances[i] + hardcoreDistances[v] )
      return false;

  return true;
}
开发者ID:jarpon,项目名称:epitraits,代码行数:16,代码来源:spatialmodelmaximalrepulsion3d.cpp

示例4: insert

	bool BufferPrograms::insert(Vertices &vertices)
	{
		SCOPE_profile_cpu_function("RenderTimer");
		if (vertices.nbr_buffer() != _types.size()) {
			return (false);
		}
		for (auto index = 0ull; index < vertices.nbr_buffer(); ++index) {
			if (_types[index] != vertices.get_type(index)) {
				return (false);
			}
		}
		for (auto &buffer_targeted : _buffers) {
			vertices.set_block_memory(buffer_targeted->push_back(vertices.transfer_data(buffer_targeted->name())), buffer_targeted->name());
		}
		vertices.set_indices_block_memory(_indices_buffer.push_back(vertices.transfer_indices_data()));
		return (true);
	}
开发者ID:Another-Game-Engine,项目名称:AGE,代码行数:17,代码来源:BufferPrograms.cpp

示例5: writeToLog

    void writeToLog(Logging::Log* plog)
    {
        std::stringstream logmessage;

        using std::endl;
        using std::cout;

        logmessage << "MeshData:: " << std::endl << "Vertices : " << std::endl;
        for (int i = 0; i < m_Vertices.size(); i++)
        {
            logmessage << i << ": " << m_Vertices[i] << endl;
        }
        logmessage << "Indices & Normals : " << endl;
        for (int i = 0; i < m_Faces.size(); i++)
        {
            logmessage << i << ": " << m_Faces[i] << "\t n:" << m_Normals[i] << std::endl;
        }
        plog->logMessage(logmessage.str());
    };
开发者ID:gabyx,项目名称:GRSFramework,代码行数:19,代码来源:MeshData.hpp

示例6: addCone

/**
 * Add all the outgoing edges from the vertex v to the horizon edges.
 * Also, update the conflict graph for the newly added faces.
 */
void addCone(Arrangement &arr, Vertex *v, Edges &horizon, Vertices &vertices)
{
	int n = horizon.size();

	Edges spokes1;
	Edges spokes2;
	for (int i = 0; i < n; ++i) {
		Edge *e0 = horizon[i];

		Edge *e1 = arr.addHalfEdge(e0->tail, NULL, NULL, false);
		e1->id = edge_id++;
		Edge *e2 = arr.addHalfEdge(v, NULL, NULL, false);
		e2->id = edge_id++;
		e1->twin = e2;
		e2->twin = e1;
		spokes1.push_back(e1);
		spokes2.push_back(e2);
	}

	// order the edges around the vertex, i.e. set the next pointer correctly
	for (int i = 0; i < n; ++i) {
		Edge *e = horizon[i];
		e->twin->next = spokes1[(i + 1) % n];
		spokes1[i]->next = e;
		spokes2[i]->next = spokes2[(i - 1 + n) % n];
	}

	// Add the corresponding faces
	for (int i = 0; i < n; ++i) {
		Face *f = new Face;
		arr.faces.push_back(f);
		f->id = face_id++;
		arr.addBoundary(horizon[i], f);

		// Also, update the conflict graph for added faces.
		for (int j = 0; j < vertices.size(); ++j) {
			if (f->visible(vertices[j])) {
				f->visibleVertices.push_back(vertices[j]);
				vertices[j]->visibleFaces.push_back(f);
			}
		}
	}
}
开发者ID:gnishida,项目名称:Geometry3,代码行数:47,代码来源:hull3.C

示例7: listUpdateVertices

/**
 * List up all the vertices that have to be tested for the conflict graph.
 */
void listUpdateVertices(Arrangement &arr, Vertex *v, Edges &horizon, Vertices &vertices)
{
	map<Vertex*, bool> hashtable;

	for (int i = 0; i < horizon.size(); ++i) {
		Face* f1 = horizon[i]->face;
		Face* f2 = horizon[i]->twin->face;

		for (int j = 0; j < f1->visibleVertices.size(); ++j) {
			if (f1->visibleVertices[j] != v) {
				hashtable[f1->visibleVertices[j]] = true;
			}
		}
		for (int j = 0; j < f2->visibleVertices.size(); ++j) {
			if (f2->visibleVertices[j] != v) {
				hashtable[f2->visibleVertices[j]] = true;
			}
		}
	}

	for (map<Vertex*, bool>::iterator it = hashtable.begin(); it != hashtable.end(); ++it) {
		vertices.push_back((*it).first);
	}
}
开发者ID:gnishida,项目名称:Geometry3,代码行数:27,代码来源:hull3.C

示例8: expand_dyn

	void expand_dyn(Vertices &R){// diff -> diff with no dyn
		S[level].i1 = S[level].i1 + S[level - 1].i1 - S[level].i2;//diff
		S[level].i2 = S[level - 1].i1;//diff
		while((int)R.size()) {
			if((int)Q.size() + R.back().d > (int)QMAX.size()){
				Q.push_back(R.back().i); Vertices Rp; cut2(R, Rp);
				if((int)Rp.size()){
					if((float)S[level].i1 / ++pk < Tlimit) degree_sort(Rp);//diff
					color_sort(Rp);
					S[level].i1++, level++;//diff
					expand_dyn(Rp);
					level--;//diff
				}
				else if((int)Q.size() > (int)QMAX.size()) QMAX = Q;
				Q.pop_back();
			}
			else return;
			R.pop_back();
		}
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:20,代码来源:MaximumClique.cpp

示例9: gnuplot_print_vertices

void gnuplot_print_vertices(std::ostream& out, const Vertices& vertices)
{
    for (Vertex_iterator it = vertices.begin(); it != vertices.end(); ++it)
        out << (*it) << " " << it->unique_id() << endl;
}
开发者ID:SoumyajitG,项目名称:VolRoverN,代码行数:5,代码来源:print_utils.cpp

示例10: PCL_DEBUG

pcl::simulation::TriangleMeshModel::TriangleMeshModel (pcl::PolygonMesh::Ptr plg)
{
  Vertices vertices;
  Indices indices;

  bool found_rgb = false;
  for (size_t i=0; i < plg->cloud.fields.size () ; ++i)
    if (plg->cloud.fields[i].name.compare ("rgb") == 0)
      found_rgb = true;

  if (found_rgb)
  {
    pcl::PointCloud<pcl::PointXYZRGB> newcloud;
    pcl::fromROSMsg (plg->cloud, newcloud);

    PCL_DEBUG("RGB Triangle mesh: ");
    PCL_DEBUG("Mesh polygons: %ld", plg->polygons.size ());
    PCL_DEBUG("Mesh points: %ld", newcloud.points.size ());

    Eigen::Vector4f tmp;
    for(size_t i=0; i< plg->polygons.size (); ++i)
    { // each triangle/polygon
      pcl::Vertices apoly_in = plg->polygons[i];
      for(size_t j = 0; j < apoly_in.vertices.size (); ++j)
      { // each point
        uint32_t pt = apoly_in.vertices[j];
        tmp = newcloud.points[pt].getVector4fMap();
        vertices.push_back (Vertex (Eigen::Vector3f (tmp (0), tmp (1), tmp (2)),
                                    Eigen::Vector3f (newcloud.points[pt].r/255.0f,
                                                     newcloud.points[pt].g/255.0f,
                                                     newcloud.points[pt].b/255.0f)));
        indices.push_back (indices.size ());
      }
    }
  }
  else
  {
    pcl::PointCloud<pcl::PointXYZ> newcloud;
    pcl::fromROSMsg (plg->cloud, newcloud);
    Eigen::Vector4f tmp;
    for(size_t i=0; i< plg->polygons.size (); i++)
    { // each triangle/polygon
      pcl::Vertices apoly_in = plg->polygons[i];
      for(size_t j=0; j< apoly_in.vertices.size (); j++)
      { // each point
        uint32_t pt = apoly_in.vertices[j];
        tmp = newcloud.points[pt].getVector4fMap();
        vertices.push_back (Vertex (Eigen::Vector3f (tmp (0), tmp (1), tmp (2)),
                                    Eigen::Vector3f (1.0, 1.0, 1.0)));
        indices.push_back (indices.size ());
      }
    }
  }

  PCL_DEBUG("Vertices: %ld", vertices.size ());
  PCL_DEBUG("Indices: %ld", indices.size ());

  glGenBuffers (1, &vbo_);
  glBindBuffer (GL_ARRAY_BUFFER, vbo_);
  glBufferData (GL_ARRAY_BUFFER, vertices.size () * sizeof (vertices[0]), &(vertices[0]), GL_STATIC_DRAW);
  glBindBuffer (GL_ARRAY_BUFFER, 0);

  glGenBuffers (1, &ibo_);
  glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, ibo_);
  glBufferData (GL_ELEMENT_ARRAY_BUFFER, indices.size () * sizeof (indices[0]), &(indices[0]), GL_STATIC_DRAW);
  glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);

  if (indices.size () > std::numeric_limits<GLuint>::max ())
    PCL_THROW_EXCEPTION(PCLException, "Too many vertices");

  size_ = static_cast<GLuint>(indices.size ());
}
开发者ID:Bardo91,项目名称:pcl,代码行数:72,代码来源:model.cpp

示例11: assert

void MDAL::Driver3Di::populateFacesAndVertices( Vertices &vertices, Faces &faces )
{
  assert( vertices.empty() );
  size_t faceCount = mDimensions.size( CFDimensions::Face2D );
  faces.resize( faceCount );
  size_t verticesInFace = mDimensions.size( CFDimensions::MaxVerticesInFace );
  size_t arrsize = faceCount * verticesInFace;
  std::map<std::string, size_t> xyToVertex2DId;

  // X coordinate
  int ncidX = mNcFile.getVarId( "Mesh2DContour_x" );
  double fillX = mNcFile.getFillValue( ncidX );
  std::vector<double> faceVerticesX( arrsize );
  if ( nc_get_var_double( mNcFile.handle(), ncidX, faceVerticesX.data() ) ) throw MDAL_Status::Err_UnknownFormat;

  // Y coordinate
  int ncidY = mNcFile.getVarId( "Mesh2DContour_y" );
  double fillY = mNcFile.getFillValue( ncidY );
  std::vector<double> faceVerticesY( arrsize );
  if ( nc_get_var_double( mNcFile.handle(), ncidY, faceVerticesY.data() ) ) throw MDAL_Status::Err_UnknownFormat;

  // now populate create faces and backtrack which vertices
  // are used in multiple faces
  for ( size_t faceId = 0; faceId < faceCount; ++faceId )
  {
    Face face;

    for ( size_t faceVertexId = 0; faceVertexId < verticesInFace; ++faceVertexId )
    {
      size_t arrId = faceId * verticesInFace + faceVertexId;
      Vertex vertex;
      vertex.x = faceVerticesX[arrId];
      vertex.y = faceVerticesY[arrId];
      vertex.z = 0;

      if ( MDAL::equals( vertex.x, fillX ) || MDAL::equals( vertex.y, fillY ) )
        break;


      size_t vertexId;

      std::string key = std::to_string( vertex.x ) + "," + std::to_string( vertex.y );
      const auto it = xyToVertex2DId.find( key );
      if ( it == xyToVertex2DId.end() )
      {
        // new vertex
        vertexId = vertices.size();
        xyToVertex2DId[key] = vertexId;
        vertices.push_back( vertex );
      }
      else
      {
        // existing vertex
        vertexId = it->second;
      }

      face.push_back( vertexId );

    }

    faces[faceId] = face;
  }

  // Only now we have number of vertices, since we identified vertices that
  // are used in multiple faces
  mDimensions.setDimension( CFDimensions::Vertex2D, vertices.size() );
}
开发者ID:FERRATON,项目名称:QGIS,代码行数:67,代码来源:mdal_3di.cpp

示例12: main

int main(int argc, char** argv)
{
  if(argc != 3)
    return usage(argv[0]);
  mark_tag vertex_index(1), vertex_x(2), vertex_y(3), vertex_z(4);

  sregex tface_re = bos >> *space >> "TFACE" >> *space >> eos;

  sregex vertex_re = bos >> *space >> "VRTX" 
			 >> +space >> (vertex_index=+_d)
			 >> +space >> (vertex_x=+(digit|'-'|'+'|'.'))
			 >> +space >> (vertex_y=+(digit|'-'|'+'|'.'))
			 >> +space >> (vertex_z=+(digit|'-'|'+'|'.'))
			 >> eos;

  sregex triangle_re = bos >> *space >> "TRGL"
			   >> +space >> (s1=+digit)
			   >> +space >> (s2=+digit)
			   >> +space >> (s3=+digit)
			   >> eos;
  sregex end_re = bos >> *space >> "END" >> *space >> eos;

  std::ifstream input(argv[1]);
  std::ofstream output(argv[2]);

  if(!input) {
    std::cerr << "Cannot read \"" << argv[1] << "\"!\n";
    return EXIT_FAILURE;
  }
  if(!output) {
    std::cerr << "Cannot write to \"" << argv[2] << "\"!\n";
    return EXIT_FAILURE;
  }

  std::string line;
  std::getline(input, line);
  smatch results;
  while(input && ! regex_match(line, tface_re)) // search line "TFACE"
  {
    std::getline(input, line);
  }
  std::getline(input, line);
  while(input && regex_match(line, results, vertex_re)) {
    vertices.push_back(boost::make_tuple(results[vertex_x],
					 results[vertex_y],
					 results[vertex_z]));
    std::getline(input, line);
  }
  while(input && regex_match(line, results, triangle_re)) {
    std::stringstream s;
    int i, j, k;
    s << results[1] << " " << results[2] << " " << results[3];
    s >> i >> j >> k;
    faces.push_back(boost::make_tuple(i, j, k));
    std::getline(input, line);
  }
  if(!input || !regex_match(line, end_re))
    return incorrect_input("premature end of file!");

  output << "OFF " << vertices.size() << " " << faces.size() << " " << "0\n";
  for(Vertices::const_iterator vit = vertices.begin(), vend = vertices.end();
      vit != vend; ++vit)
    output << boost::get<0>(*vit) << " "
	   << boost::get<1>(*vit) << " "
	   << boost::get<2>(*vit) << "\n";
  for(Faces::const_iterator fit = faces.begin(), fend = faces.end();
      fit != fend; ++fit)
    output << "3 " << boost::get<0>(*fit)
	   << " " << boost::get<1>(*fit)
	   << " " << boost::get<2>(*fit) << "\n";
  if(output)
    return EXIT_SUCCESS;
  else
    return EXIT_FAILURE;
};
开发者ID:ArcEarth,项目名称:cgal,代码行数:75,代码来源:GOCAD_xyz_to_OFF.cpp

示例13:

CoordSystem3 Quadrangle3::getCoordinateSystem(const Vertices& vertices) const {
	auto newX = (vertices.at(1) - vertices.at(0)).ort();
	auto newY = (vertices.at(3) - vertices.at(0)).ort();
	auto newZ = (newX & newY).ort();
	return {vertices.at(0), newX, newY, newZ};
}
开发者ID:frostoov,项目名称:treklibs,代码行数:6,代码来源:quadrangle3.cpp

示例14: if

/// Read an event and fill a vector of MCParticles.
Geant4EventReader::EventReaderStatus
Geant4EventReaderGuineaPig::readParticles(int /* event_number */, 
                                          Vertices& vertices,
                                          vector<Particle*>& particles)   {


  // if no number of particles per event set, we will read the whole file
  if ( m_part_num < 0 )
    m_part_num = std::numeric_limits<int>::max() ; 



  // First check the input file status
  if ( m_input.eof() )   {
    return EVENT_READER_EOF;
  }
  else if ( !m_input.good() )   {
    return EVENT_READER_IO_ERROR;
  }

  double Energy;
  double betaX;
  double betaY;
  double betaZ;
  double posX;
  double posY;
  double posZ;

  //  Loop over particles
  for( int counter = 0; counter < m_part_num ; ++counter ){      

    // need to check for NAN as not all ifstream implementations can handle this directly
    std::string lineStr ;
    std::getline( m_input, lineStr ) ;

    if( m_input.eof() ) {
      if( counter==0 ) { 
        return EVENT_READER_IO_ERROR ;  // reading first particle of event failed 
      } else{
        ++m_currEvent;
        return EVENT_READER_OK ; // simply EOF
      }
    }

    std::transform(lineStr.begin(), lineStr.end(), lineStr.begin(), ::tolower);
    if( lineStr.find("nan") != std::string::npos){

      printout(WARNING,"EventReader","### Read line with 'nan' entries - particle will be ignored  ! " ) ;
      continue ;
    }
    std::stringstream m_input_str( lineStr ) ;

    m_input_str  >> Energy
		 >> betaX   >> betaY >> betaZ
		 >> posX    >> posY  >> posZ ;

    
    //    printf(" ------- %e  %e  %e  %e  %e  %e  %e \n", Energy,betaX, betaY,betaZ,posX,posY,posZ ) ;

    //
    //  Create a MCParticle and fill it from stdhep info
    Particle* p = new Particle(counter);
    PropertyMask status(p->status);

    //  PDGID: If Energy positive (negative) particle is electron (positron)
    p->pdgID  = 11;
    p->charge = -1;
    if(Energy < 0.0) {
      p->pdgID = -11;
      p->charge = +1;
    }

    //  Momentum vector
    p->pex = p->psx = betaX*TMath::Abs(Energy)*GeV;
    p->pey = p->psy = betaY*TMath::Abs(Energy)*GeV;
    p->pez = p->psz = betaZ*TMath::Abs(Energy)*GeV;

    //  Mass
    p->mass = 0.0005109989461*GeV;
    //


    //  Creation time (note the units [1/c_light])
    // ( not information in GuineaPig files )
    p->time       = 0.0;
    p->properTime = 0.0;


    //  Vertex
    p->vsx = posX*nm;
    p->vsy = posY*nm;
    p->vsz = posZ*nm;

    Vertex* vtx = new Vertex ;
    vtx->x = p->vsx ;
    vtx->y = p->vsy ;
    vtx->z = p->vsz ;
    vtx->time = p->time ;

//.........这里部分代码省略.........
开发者ID:AIDASoft,项目名称:DD4hep,代码行数:101,代码来源:Geant4EventReaderGuineaPig.cpp

示例15: degree_sort

	void degree_sort(Vertices &R){
		set_degrees(R); sort(R.begin(), R.end(), desc_degree);
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:3,代码来源:MaximumClique.cpp


注:本文中的Vertices类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。