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


C++ Facet类代码示例

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


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

示例1: SetEdgeLineVisibility

static void SetEdgeLineVisibility (Facet& f, 
                                   int a, int AzmStride,
                                   int p, int PolStride, 
                                   bool ReverseOrientation = false)
{
  // no individual setting, visibility is either true or false
  if (AzmStride == 1 && PolStride == 1) return;

  // individual setting
  int mask = 0;

  // three or four vertices
  if (ReverseOrientation) {
    if ((a+1) % AzmStride == 0) mask |= 4;
    if ( a    % AzmStride == 0) mask |= 1;
  } else {
    if ((a+1) % AzmStride == 0) mask |= 1;
    if ( a    % AzmStride == 0) mask |= 4;
  }
  
  if (p % PolStride == 0) mask |= 2;

  // four vertices
  if (f.GetNumVertices() == 4) 
    if ((p+1) % PolStride == 0) mask |= 8;

  // set edge line visibility
  f.SetEdgeLineVisibility(Facet::Individual,mask);
}
开发者ID:lucafuji,项目名称:Gene-Correlation,代码行数:29,代码来源:warpmatrixtosphere.cpp

示例2: getFacetFromPoint

// Place un point p sur la face fs, et relie p aux sommets de fs.
Halfedge_handle DegradeAnObject::putAPointOnAFacet(Point_3 p, int index) {
	Facet fs;
	getFacetFromPoint(p, fs, index);
	Halfedge_handle h = polys[index].create_center_vertex(fs.halfedge());
	h->vertex()->point() = p;
	return h;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:8,代码来源:DegradeAnObject.cpp

示例3: sizeof

bool STLWriter::writeSTLFacet(const Facet& facet, const bool& isBinaryMode)
{
    if(isBinaryMode)
    {
        char* c = new char[12 * sizeof(float) + 2];

        ((float*) c)[0] = facet.getNormal()[0];
        ((float*) c)[1] = facet.getNormal()[1];
        ((float*) c)[2] = facet.getNormal()[2];

        for(int i = 0; i < NUM_VERTICES; ++i)
        {
            ((float*) c)[i + 0 + 2] = facet.getVertexAt(i).x;
            ((float*) c)[i + 1 + 2] = facet.getVertexAt(i).y;
            ((float*) c)[i + 2 + 2] = facet.getVertexAt(i).z;
        }

        outputFile_.write(c, 12 * sizeof(float) + 2);
    }
    else
    {
        string s = buildFacetString(facet);
        outputFile_.write(s.data(), s.length());
    }

    return true;
}
开发者ID:rsingla92,项目名称:aegle,代码行数:27,代码来源:STLWriter.cpp

示例4: buildFacetString

string STLWriter::buildFacetString(const Facet& facet)
{
    normal n = facet.getNormal();
    vertices v = facet.getVertices();
    std::ostringstream ss;
    string ret = "\nfacet normal ";

    for(size_t i = 0; i < n.size(); ++i)
    {
        ss << n[i];
        ret += ss.str() + " ";
    }

    ret += "\n\t outer loop\n";

    for(size_t i = 0; i < v.size(); ++i)
    {
        ret += "\t\tvertex ";
        
        ss << v[i].x;
        ret += ss.str() + " ";

        ss << v[i].y;
        ret += ss.str() + " ";

        ss << v[i].z;
        ret += ss.str() + " ";
        
        ret += "\n";
    }

    ret += "\tendloop\n";
    ret += "endfacet\n";
    return ret;
}
开发者ID:rsingla92,项目名称:aegle,代码行数:35,代码来源:STLWriter.cpp

示例5: printf

char Facet::isClosed() const
{
	for (int i=0; i<3; i++) 
	{
         Edge *opposite = m_edges[i]->getTwin();
		 if(!opposite) 
		 {
			printf("edge not connected\n");
			return 0;
		}
		 Facet * f = (Facet *)(opposite->getFace());
		 
		 if(!f){
			printf("edge has no face\n");
			return 0;
		}
		
		if(f->getIndex() < 0)
		{
			printf("face %d is removed\n", f->getIndex());
			return 0;
		}
		 
	}
	
	return 1;
}
开发者ID:ahmidou,项目名称:aphid,代码行数:27,代码来源:Facet.cpp

示例6: vertexToPolygon

void ComponentConversion::vertexToPolygon(const std::vector<unsigned> & src, std::vector<unsigned> & polyIds, std::vector<unsigned> & vppIds) const
{
	if(src.size() < 2) return;
	
	std::vector<unsigned>::const_iterator it0;
	std::vector<unsigned>::const_iterator it1 = src.begin();
	it1++;
	for(; it1 != src.end(); ++it1) {
		it0 = it1;
		it0--;
		
		VertexAdjacency & adj = m_topology->getAdjacency(*it0);
		char found = 0;
		Edge * e = adj.connectedToVertexBy(*it1, found);
		if(found) {
			Facet *f = (Facet *)e->getFace();
			if(appendUnique(f->getPolygonIndex(), polyIds)) {
				vppIds.push_back(*it0);
				vppIds.push_back(*it1);
			}
			
			Edge *opp = e->getTwin();
			if(opp) {
				f = (Facet *)opp->getFace();
				if(appendUnique(f->getPolygonIndex(), polyIds)) {
					vppIds.push_back(*it0);
					vppIds.push_back(*it1);
				}
			}
		}
	}
}
开发者ID:ahmidou,项目名称:aphid,代码行数:32,代码来源:ComponentConversion.cpp

示例7: f

//-----------------------------------------------------------------------------
double HexahedronCell::facet_area(const Cell& cell, std::size_t facet) const
{
  // Create facet from the mesh and local facet number
  const Facet f(cell.mesh(), cell.entities(1)[facet]);

  // Get global index of vertices on the facet
  const std::size_t v0 = f.entities(0)[0];
  const std::size_t v1 = f.entities(0)[1];
  const std::size_t v2 = f.entities(0)[2];
  const std::size_t v3 = f.entities(0)[3];

  // Get mesh geometry
  const MeshGeometry& geometry = cell.mesh().geometry();

  // Need to check points are co-planar

  const Point p0 = geometry.point(v0);
  const Point p1 = geometry.point(v1);
  const Point p2 = geometry.point(v2);
  const Point p3 = geometry.point(v3);

  dolfin_not_implemented();

  return 0.0;
}
开发者ID:vincentqb,项目名称:dolfin,代码行数:26,代码来源:HexahedronCell.cpp

示例8: SetColor

void Scene::WireFacet (Facet& f)
{
  // number of vertices
  int n = f.GetNumVertices();

  // remember previous line color
  ColorF previous_color = foreground_color;

  // =======================================================
  // testing: fog for edgelines to get a depth cueing effect
  // =======================================================
  if (fog_opacity) {
    float cx,cy,cz;
    f.Center(cx,cy,cz); // wastes time !
    SetColor( ColorF_Weighted(0.5*(1-tanh((6/fog_opacity)
			      *(hypot(cx,cy,cz)-fog_distance-1))),
			      previous_color,fog_color) );
  }

  // facet is degenerate (a line)
  if (n == 2)                     // THROW OUT !!!!!!!!!!!!!!
    Line( f[0].p,f[1].p );

  // loop through edges
  else
    if (f.edgelines == Facet::Individual) {
      for (int i = 0, j = n-1; i < n; j = i++)
	if (f.GetEdgeLine(j)) Line( f[j].p,f[i].p );  
    } else
      for (int i = 0, j = n-1; i < n; j = i++)
	Line( f[j].p,f[i].p ); 

  // reset previous color
  if (fog_opacity) SetColor(previous_color);
}
开发者ID:lucafuji,项目名称:Gene-Correlation,代码行数:35,代码来源:scnshade.cpp

示例9: Facet

char MembraneDeformer::buildTopology()
{
	const unsigned nv = m_mesh->getNumVertices();
	
	m_topology = new VertexAdjacency[nv];
	
	for(unsigned i = 0; i < nv; i++) {
		VertexAdjacency & v = m_topology[i];
		v.setIndex(i);
		v.m_v = &(m_mesh->getVertices()[i]);
	}
	
	const unsigned nf = m_mesh->getNumFaces();
	unsigned a, b, c;
	
	for(unsigned i = 0; i < nf; i++) {
		a = m_mesh->getIndices()[i * 3];
		b = m_mesh->getIndices()[i * 3 + 1];
		c = m_mesh->getIndices()[i * 3 + 2];
		Facet * f = new Facet(&m_topology[a], &m_topology[b], &m_topology[c]);
		f->setIndex(i);
		for(unsigned j = 0; j < 3; j++) {
			Edge * e = f->edge(j);
			m_topology[e->v0()->getIndex()].addEdge(e);
			m_topology[e->v1()->getIndex()].addEdge(e);
		}
	}
	
	for(unsigned i = 0; i < nv; i++) {
		m_topology[i].findNeighbors();
		m_topology[i].computeWeights();
		m_topology[i].computeDifferentialCoordinate();
	}
	return 1;
}
开发者ID:ahmidou,项目名称:aphid,代码行数:35,代码来源:MembraneDeformer.cpp

示例10: f

//-----------------------------------------------------------------------------
double TriangleCell::facet_area(const Cell& cell, std::size_t facet) const
{
  // Create facet from the mesh and local facet number
  const Facet f(cell.mesh(), cell.entities(1)[facet]);

  // Get global index of vertices on the facet
  const std::size_t v0 = f.entities(0)[0];
  const std::size_t v1 = f.entities(0)[1];

  // Get mesh geometry
  const MeshGeometry& geometry = cell.mesh().geometry();

  // Get the coordinates of the two vertices
  const double* p0 = geometry.x(v0);
  const double* p1 = geometry.x(v1);

  // Compute distance between vertices
  double d = 0.0;
  for (std::size_t i = 0; i < geometry.dim(); i++)
  {
    const double dp = p0[i] - p1[i];
    d += dp*dp;
  }

  return std::sqrt(d);
}
开发者ID:ellipsis14,项目名称:dolfin,代码行数:27,代码来源:TriangleCell.cpp

示例11: computeBCTopological

//-----------------------------------------------------------------------------
void NewDirichletBC::computeBCTopological(std::map<uint, real>& boundary_values,
                                       Facet& facet,
                                       BoundaryCondition::LocalData& data)
{
  // Get cell to which facet belongs (there may be two, but pick first)
  Cell cell(_mesh, facet.entities(facet.dim() + 1)[0]);
  UFCCell ufc_cell(cell);
  
  // Get local index of facet with respect to the cell
  const uint local_facet = cell.index(facet);
  
  // Interpolate function on cell
  g.interpolate(data.w, ufc_cell, *data.finite_element, cell, local_facet);
  
  // Tabulate dofs on cell
  data.dof_map->tabulate_dofs(data.cell_dofs, ufc_cell);

  // Tabulate which dofs are on the facet
  data.dof_map->tabulate_facet_dofs(data.facet_dofs, local_facet);
  
  // Pick values for facet
  for (uint i = 0; i < data.dof_map->num_facet_dofs(); i++)
  {
    const uint dof = data.offset + data.cell_dofs[data.facet_dofs[i]];
    const real value = data.w[data.facet_dofs[i]];
    boundary_values[dof] = value;
  }
}
开发者ID:njansson,项目名称:unicorn-hpc,代码行数:29,代码来源:NewDirichletBC.cpp

示例12: Line

void Scene::ConstantFacet (Facet& f)
//
// Uses the global intermediate storage array pix.
//
{
    int i,j;
    short r,g,b;
    long color;
    
    // number of vertices
    int n = f.GetNumVertices();
    
    // facet is degenerate (a line) ----- CURRENTLY DEGENERATE NOT ALLOWED
    if (n == 2) {
	Line(f[0].p,f[1].p);
	return;
    }

    // can't happen !
    if (n < 2 || n > MaxVertices) {
	Warn("Scene::ConstantFacet: number of vertices out of range");
	return;
    }

    if (coloring == Global) {
	r = (short)(mat.color.red   * 255); // normalize to 0..255
	g = (short)(mat.color.green * 255);
	b = (short)(mat.color.blue  * 255);
	
    } else { 		// per-facet colors are assumed
	r = f.front.red;
	g = f.front.green;
        b = f.front.blue;
    } 
     
    // copy projected vertex coordinates to polygon array
    for (i = 0; i < n; i++) pix[i] = f[i].p;
     
    // find color in colormap
    color = LookupColor(r,g,b,&mat);

    // draw outlines if requested
    if (edgelines == 1) 
        Polygon(n,pix,color,Outline|Fill);
    else if (edgelines == 0)
        Polygon(n,pix,color,Fill);
    else if (edgelines == Facet::Individual ) {
	if (f.edgelines == 1)
	    Polygon(n,pix,color,Outline|Fill); 
	else if (f.edgelines == 0)
	    Polygon(n,pix,color,Fill);
	else if (f.edgelines == Facet::Individual) {
	    Polygon(n,pix,color,Fill);
	    for (i = 0, j = n-1; i < n; j = i++) 
	      if ( f.GetEdgeLine(j) ) Line(pix[j],pix[i]);
	}	
    }

}
开发者ID:lucafuji,项目名称:Gene-Correlation,代码行数:59,代码来源:scnshade.cpp

示例13: TEST_F

  TEST_F(DictionaryTest, FacetLoad){
    string output_file_neighbours = "dictFacetsTestFile_neighbours.dat";
    string output_file_vertexes = "dictFacetsTestFile_vertex.dat";

    ofstream neighbours_ofs(output_file_neighbours.c_str());
    ofstream vertexes_ofs(output_file_vertexes.c_str());

    if(neighbours_ofs.good()){
      neighbours_ofs << "4\n";
      neighbours_ofs << "4 1234 4331 4314 55\n";
      neighbours_ofs << "4 83 7583 38 21\n";
      neighbours_ofs << "4 321 32 1 23\n";
      neighbours_ofs << "4 123 13 22 34\n";
      neighbours_ofs.close(); 
    }

    if(vertexes_ofs.good()){
      vertexes_ofs << "4\n";
      vertexes_ofs << "4 91 89 72 2\n";
      vertexes_ofs << "4 33 123 43 1\n";
      vertexes_ofs << "4 18 22 12 43\n";
      vertexes_ofs << "4 2 32 31 89\n";
      vertexes_ofs.close();
    }

    dictFacets->load("dictFacetsTestFile");

    remove("dictFacetsTestFile_vertex.dat");
    remove("dictFacetsTestFile_neighbours.dat");

    Facet firstFacet = dictFacets->getById(0);
    Facet secondFacet = dictFacets->getById(1);
    //Facet* thirdFacet = dictFacets-> getById(2);
    //Facet* fourthFacet = dictFacets->getById(3);

    // Test firstFacet
    ASSERT_EQ(firstFacet.getNeighboursId()[0],1234);
    ASSERT_EQ(firstFacet.getNeighboursId()[1],4331);
    ASSERT_EQ(firstFacet.getNeighboursId()[2],4314);
    ASSERT_EQ(firstFacet.getNeighboursId()[3],55);

    ASSERT_EQ(firstFacet.getPointsId()[0],91);
    ASSERT_EQ(firstFacet.getPointsId()[1],89);
    ASSERT_EQ(firstFacet.getPointsId()[2],72);
    ASSERT_EQ(firstFacet.getPointsId()[3],2);

    // Test secondFacet
    ASSERT_EQ(secondFacet.getNeighboursId()[0],83);
    ASSERT_EQ(secondFacet.getNeighboursId()[1],7583);
    ASSERT_EQ(secondFacet.getNeighboursId()[2],38);
    ASSERT_EQ(secondFacet.getNeighboursId()[3],21);

    ASSERT_EQ(secondFacet.getPointsId()[0],33);
    ASSERT_EQ(secondFacet.getPointsId()[1],123);
    ASSERT_EQ(secondFacet.getPointsId()[2],43);
    ASSERT_EQ(secondFacet.getPointsId()[3],1);

  }
开发者ID:matbravo,项目名称:voids,代码行数:58,代码来源:DictionaryTest.cpp

示例14: splitEdgesOfFacet

Halfedge_handle DegradeAnObject::splitFacet(Facet fs, int index) {
	Halfedge_handle hh1 = fs.halfedge();
	Halfedge_handle hh2 = fs.halfedge()->next();
	Halfedge_handle hh3 = fs.halfedge()->next()->next();
	splitEdgesOfFacet(fs, index);
	Halfedge_handle h = barycentricMesh(fs, index);
	noTVertice(hh1, hh2, hh3, index);
	return h;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:9,代码来源:DegradeAnObject.cpp

示例15: print_facet

/**
 * Prints the points around a facet.
 */
void print_facet(const Facet& f)
{
    typedef Vertex::Halfedge_around_facet_const_circulator Circulator;
    Circulator current = f.facet_begin();
    Circulator end = f.facet_begin();
    do {
        cout << current->vertex()->point() << endl;
    } while (++current != end);
    cout << endl;
}
开发者ID:codonnell,项目名称:cgal-watershedtin,代码行数:13,代码来源:primitives.cpp


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