本文整理汇总了C++中FaceSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ FaceSet::end方法的具体用法?C++ FaceSet::end怎么用?C++ FaceSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FaceSet
的用法示例。
在下文中一共展示了FaceSet::end方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitFace
Vec3f Brush::splitFace(const FaceInfo& faceInfo, const Vec3f& delta) {
FaceSet newFaces;
FaceSet droppedFaces;
Vec3f newVertexPosition = m_geometry->splitFace(m_worldBounds, faceInfo, delta, newFaces, droppedFaces);
for (FaceSet::iterator it = droppedFaces.begin(); it != droppedFaces.end(); ++it) {
Face* dropFace = *it;
dropFace->setBrush(NULL);
m_faces.erase(std::remove(m_faces.begin(), m_faces.end(), dropFace), m_faces.end());
delete dropFace;
}
for (FaceList::iterator it = m_faces.begin(); it != m_faces.end(); ++it) {
Face* face = *it;
face->invalidateTexAxes();
face->invalidateVertexCache();
}
for (FaceSet::iterator it = newFaces.begin(); it != newFaces.end(); ++it) {
Face* newFace = *it;
newFace->setBrush(this);
m_faces.push_back(newFace);
}
setNeedsRebuild(true);
return newVertexPosition;
}
示例2: moveFaces
FaceInfoList Brush::moveFaces(const FaceInfoList& faceInfos, const Vec3f& delta) {
FaceSet newFaces;
FaceSet droppedFaces;
const FaceInfoList newFaceInfos = m_geometry->moveFaces(m_worldBounds, faceInfos, delta, newFaces, droppedFaces);
for (FaceSet::iterator it = droppedFaces.begin(); it != droppedFaces.end(); ++it) {
Face* face = *it;
face->setBrush(NULL);
m_faces.erase(std::remove(m_faces.begin(), m_faces.end(), face), m_faces.end());
delete face;
}
for (FaceList::iterator it = m_faces.begin(); it != m_faces.end(); ++it) {
Face* face = *it;
face->invalidateTexAxes();
face->invalidateVertexCache();
}
for (FaceSet::iterator it = newFaces.begin(); it != newFaces.end(); ++it) {
Face* face = *it;
face->setBrush(this);
m_faces.push_back(face);
}
setNeedsRebuild(true);
return newFaceInfos;
}
示例3: SetFromFaces
void Box::SetFromFaces(FaceSet& faces) {
if (faces.Size() == 0) return;
// initialize max and min with the first member of the face set
FaceList::iterator itr = faces.begin();
Vector<3,float> max((*itr)->vert[0]);
Vector<3,float> min(max);
// find the boundary values
for (; itr != faces.end(); itr++) {
for (int i=0; i<3; i++) {
Vector<3,float> v = (*itr)->vert[i];
for (int j=0; j<3; j++)
if (v[j] < min[j]) min[j] = v[j];
else if (v[j] > max[j]) max[j] = v[j];
}
}
// set box center
center = (max - min) / 2 + min;
// set corner vector
corner = max - center;
// compute the corners
float x = corner[0];
float y = corner[1];
float z = corner[2];
SetCorner(1,1,1, center+Vector<3,float>( x, y, z));
SetCorner(1,1,0, center+Vector<3,float>( x, y,-z));
SetCorner(1,0,1, center+Vector<3,float>( x,-y, z));
SetCorner(1,0,0, center+Vector<3,float>( x,-y,-z));
SetCorner(0,1,1, center+Vector<3,float>(-x, y, z));
SetCorner(0,1,0, center+Vector<3,float>(-x, y,-z));
SetCorner(0,0,1, center+Vector<3,float>(-x,-y, z));
SetCorner(0,0,0, center+Vector<3,float>(-x,-y,-z));
}
示例4: rebuildGeometry
void Brush::rebuildGeometry() {
delete m_geometry;
m_geometry = new BrushGeometry(m_worldBounds);
// sort the faces by the weight of their plane normals like QBSP does
Model::FaceList sortedFaces = m_faces;
std::sort(sortedFaces.begin(), sortedFaces.end(), Model::Face::WeightOrder(Planef::WeightOrder(true)));
std::sort(sortedFaces.begin(), sortedFaces.end(), Model::Face::WeightOrder(Planef::WeightOrder(false)));
FaceSet droppedFaces;
bool success = m_geometry->addFaces(sortedFaces, droppedFaces);
assert(success);
for (FaceSet::iterator it = droppedFaces.begin(); it != droppedFaces.end(); ++it) {
Face* face = *it;
face->setBrush(NULL);
m_faces.erase(std::remove(m_faces.begin(), m_faces.end(), face), m_faces.end());
delete face;
}
for (FaceList::iterator it = m_faces.begin(); it != m_faces.end(); ++it) {
Face* face = *it;
face->invalidateTexAxes();
face->invalidateVertexCache();
}
if (m_entity != NULL)
m_entity->invalidateGeometry();
}
示例5: VisitGeometryNode
/**
* The Geometry nodes textures are loaded on visit
*
* @param node Geometry node
*/
void TextureLoader::VisitGeometryNode(GeometryNode* node) {
FaceSet* faces = node->GetFaceSet();
if (faces == NULL) return;
for (FaceList::iterator face = faces->begin(); face != faces->end(); face++) {
// load face textures
LoadTextureResource((*face)->texr);
}
}
示例6: GetFaces
void Geometry::Shape2BVHMesh(const TopoDS_Shape &shape, BVHMeshPtr model) {
model->beginModel();
BRepMesh_IncrementalMesh(shape, IfcGeom::GetValue(IfcGeom::GV_DEFLECTION_TOLERANCE));
FaceSet faces;
GetFaces(shape,faces);
for (auto face=faces.begin();face!=faces.end();++face){
Face2BVHMesh(*face,model);
}
model->endModel();
}
示例7: snap
void Brush::snap(unsigned int snapTo) {
FaceSet newFaces;
FaceSet droppedFaces;
m_geometry->snap(newFaces, droppedFaces, snapTo);
for (FaceSet::iterator it = droppedFaces.begin(); it != droppedFaces.end(); ++it) {
Face* face = *it;
face->setBrush(NULL);
m_faces.erase(std::remove(m_faces.begin(), m_faces.end(), face), m_faces.end());
delete face;
}
for (FaceSet::iterator it = newFaces.begin(); it != newFaces.end(); ++it) {
Face* face = *it;
face->setBrush(this);
m_faces.push_back(face);
}
rebuildGeometry();
}
示例8: correct
void Brush::correct(float epsilon) {
FaceSet newFaces;
FaceSet droppedFaces;
m_geometry->correct(newFaces, droppedFaces, epsilon);
for (FaceSet::iterator it = droppedFaces.begin(); it != droppedFaces.end(); ++it) {
Face* face = *it;
face->setBrush(NULL);
m_faces.erase(std::remove(m_faces.begin(), m_faces.end(), face), m_faces.end());
delete face;
}
for (FaceSet::iterator it = newFaces.begin(); it != newFaces.end(); ++it) {
Face* face = *it;
face->setBrush(this);
m_faces.push_back(face);
}
rebuildGeometry();
}
示例9: getBoundaries
/**********************************************************************************//**
* \brief fetch all boundary primitives
* \param [out] vertices Boundary vertices
* \param [out] lines Boundary lines
* \param [out] faces Boundary faces
*
* An optimized version to get all boundaries. This is faster than sequentially calling
* getBoundaryVertices(),getBoundaryLines() and getBoundaryFaces().
*
*************************************************************************************/
void TopologySet::getBoundaries(std::set<Vertex*>& vertices, std::set<Line*>& lines, FaceSet& faces) {
faces.clear();
lines.clear();
vertices.clear();
if(volumetric_model) {
faces = getBoundaryFaces();
FaceSet::iterator it;
for(it=faces.begin(); it != faces.end(); it++) {
vector<int> lineNumb = Line::getLineEnumeration( *(*it)->face.begin() );
Volume *firstVol = *(*it)->volume.begin();
for(int i=0; i<4; i++) {
lines.insert( firstVol->line[lineNumb[i]] );
vertices.insert( firstVol->line[lineNumb[i]]->v1 ); // yes, this will insert all vertices (at least) twice, but it is preffered
vertices.insert( firstVol->line[lineNumb[i]]->v2 ); // to the alternative which is making more functions
}
}
} else if(surface_model) {
lines = getBoundaryLines();
set<Line*>::iterator it;
}
}
示例10: Process
void Process(const float dt, const float p) {
// Set the path to our resources
ResourceManager::AppendPath("tests/");
// Pointer to model resource.
IModelResourcePtr mod_res;
mod_res = ResourceManager::CreateModel("box.obj");
mod_res->Load();
// Get a pointer to the loaded face set.
FaceSet* fset = mod_res->GetFaceSet();
// Test if the loader has created a face set.
BOOST_CHECK(fset != NULL);
// Test of the number of faces is right
BOOST_CHECK(fset->Size() == 12);
// Check all faces.
int fc = 0;
int faceCount = 0;
FaceList::iterator itr = fset->begin();
for( ; itr!=fset->end(); itr++ ){
FacePtr f = *itr; faceCount++;
Vector<3,float> v0(faceArray[fc],faceArray[fc+1],faceArray[fc+2]); fc += 3;
Vector<3,float> v1(faceArray[fc],faceArray[fc+1],faceArray[fc+2]); fc += 3;
Vector<3,float> v2(faceArray[fc],faceArray[fc+1],faceArray[fc+2]); fc += 3;
BOOST_CHECK( f->vert[0] == v0 && f->vert[1] == v1 && f->vert[2] == v2 );
// Check that face number 6 has no material
if (faceCount == 8)
BOOST_CHECK(f->texr == NULL);
// Check that face number 9 has a material assigned
if (faceCount == 9)
BOOST_CHECK(f->texr != NULL);
}
// Check all normals.
fc = 0;
for( itr = fset->begin(); itr!=fset->end(); itr++ ){
FacePtr f = *itr;
Vector<3,float> n0(normArray[fc],normArray[fc+1],normArray[fc+2]); fc += 3;
Vector<3,float> n1(normArray[fc],normArray[fc+1],normArray[fc+2]); fc += 3;
Vector<3,float> n2(normArray[fc],normArray[fc+1],normArray[fc+2]); fc += 3;
BOOST_CHECK( f->norm[0] == n0 && f->norm[1] == n1 && f->norm[2] == n2 );
}
// Check all texture coordinates.
fc = 0;
for( itr = fset->begin(); itr!=fset->end(); itr++ ){
FacePtr f = *itr;
Vector<2,float> t0(texcArray[fc],texcArray[fc+1]); fc += 2;
Vector<2,float> t1(texcArray[fc],texcArray[fc+1]); fc += 2;
Vector<2,float> t2(texcArray[fc],texcArray[fc+1]); fc += 2;
BOOST_CHECK( f->texc[0] == t0 && f->texc[1] == t1 && f->texc[2] == t2 );
}
// Check all colors coordinates.
fc = 0;
for( itr = fset->begin(); itr!=fset->end(); itr++ ){
FacePtr f = *itr;
Vector<4,float> c0(colrArray[fc],colrArray[fc+1],colrArray[fc+2],colrArray[fc+3]); fc += 4;
Vector<4,float> c1(colrArray[fc],colrArray[fc+1],colrArray[fc+2],colrArray[fc+3]); fc += 4;
Vector<4,float> c2(colrArray[fc],colrArray[fc+1],colrArray[fc+2],colrArray[fc+3]); fc += 4;
BOOST_CHECK( f->colr[0] == c0 && f->colr[1] == c1 && f->colr[2] == c2 );
}
// Check all colors coordinates.
fc = 0;
for( itr = fset->begin(); itr!=fset->end(); itr++ ){
FacePtr f = *itr;
Vector<3,float> hard(hardNormArray[fc],hardNormArray[fc+1],hardNormArray[fc+2]); fc += 3;
BOOST_CHECK( f->hardNorm == hard );
}
GameEngine::Instance().Stop();
}
示例11: main
int main( int argc, char** argv )
{
QApplication application(argc,argv);
string inputFilename = argc > 1 ? argv[ 1 ] : examplesPath+"/samples/Al.100.vol";
int threshold = argc > 2 ? atoi( argv[ 2 ] ) : 0;
int widthNum = argc > 3 ? atoi( argv[ 3 ] ) : 2;
int widthDen = argc > 4 ? atoi( argv[ 4 ] ) : 1;
//! [polyhedralizer-readVol]
trace.beginBlock( "Reading vol file into an image." );
typedef ImageContainerBySTLVector< Domain, int> Image;
Image image = VolReader<Image>::importVol(inputFilename);
typedef functors::SimpleThresholdForegroundPredicate<Image> DigitalObject;
DigitalObject digitalObject( image, threshold );
trace.endBlock();
//! [polyhedralizer-readVol]
//! [polyhedralizer-KSpace]
trace.beginBlock( "Construct the Khalimsky space from the image domain." );
KSpace ks;
bool space_ok = ks.init( image.domain().lowerBound(), image.domain().upperBound(), true );
if (!space_ok)
{
trace.error() << "Error in the Khamisky space construction."<<endl;
return 2;
}
trace.endBlock();
//! [polyhedralizer-KSpace]
//! [polyhedralizer-SurfelAdjacency]
typedef SurfelAdjacency<KSpace::dimension> MySurfelAdjacency;
MySurfelAdjacency surfAdj( false ); // exterior in all directions.
//! [polyhedralizer-SurfelAdjacency]
//! [polyhedralizer-ExtractingSurface]
trace.beginBlock( "Extracting boundary by tracking the surface. " );
typedef KSpace::Surfel Surfel;
Surfel start_surfel = Surfaces<KSpace>::findABel( ks, digitalObject, 100000 );
typedef ImplicitDigitalSurface< KSpace, DigitalObject > MyContainer;
typedef DigitalSurface< MyContainer > MyDigitalSurface;
typedef MyDigitalSurface::ConstIterator ConstIterator;
MyContainer container( ks, digitalObject, surfAdj, start_surfel );
MyDigitalSurface digSurf( container );
trace.info() << "Digital surface has " << digSurf.size() << " surfels."
<< endl;
trace.endBlock();
//! [polyhedralizer-ExtractingSurface]
//! [polyhedralizer-ComputingPlaneSize]
// First pass to find biggest planes.
trace.beginBlock( "Decomposition first pass. Computes all planes so as to sort vertices by the plane size." );
typedef BreadthFirstVisitor<MyDigitalSurface> Visitor;
typedef ChordGenericNaivePlaneComputer<Z3,Z3::Point, DGtal::int64_t> NaivePlaneComputer;
map<Surfel,unsigned int> v2size;
for ( ConstIterator it = digSurf.begin(), itE= digSurf.end(); it != itE; ++it )
v2size[ *it ] = 0;
int j = 0;
int nb = digSurf.size();
NaivePlaneComputer planeComputer;
vector<Point> layer;
vector<Surfel> layer_surfel;
for ( ConstIterator it = digSurf.begin(), itE= digSurf.end(); it != itE; ++it )
{
if ( ( (++j) % 50 == 0 ) || ( j == nb ) ) trace.progressBar( j, nb );
Surfel v = *it;
planeComputer.init( widthNum, widthDen );
// The visitor takes care of all the breadth-first traversal.
Visitor visitor( digSurf, v );
layer.clear();
layer_surfel.clear();
Visitor::Size currentSize = visitor.current().second;
while ( ! visitor.finished() )
{
Visitor::Node node = visitor.current();
v = node.first;
int axis = ks.sOrthDir( v );
Point p = ks.sCoords( ks.sDirectIncident( v, axis ) );
if ( node.second != currentSize )
{
bool isExtended = planeComputer.extend( layer.begin(), layer.end() );
if ( isExtended )
{
for ( vector<Surfel>::const_iterator it_layer = layer_surfel.begin(),
it_layer_end = layer_surfel.end(); it_layer != it_layer_end; ++it_layer )
{
++v2size[ *it_layer ];
}
layer_surfel.clear();
layer.clear();
currentSize = node.second;
}
else
break;
}
layer_surfel.push_back( v );
layer.push_back( p );
visitor.expand();
}
}
// Prepare queue
//.........这里部分代码省略.........
示例12: reorderVertices
void MeshAlgo::reorderVertices( MeshPrimitive *mesh, int id0, int id1, int id2 )
{
FaceToEdgesMap faceToEdgesMap;
FaceToVerticesMap faceToVerticesMap;
EdgeToConnectedFacesMap edgeToConnectedFacesMap;
VertexToFacesMap vertexToFacesMap;
VertexList faceVaryingOffsets;
const std::vector<int> &vertexIds = mesh->vertexIds()->readable();
const std::vector<int> &verticesPerFace = mesh->verticesPerFace()->readable();
int numFaces = verticesPerFace.size();
int numVerts = mesh->variableSize( PrimitiveVariable::Vertex );
if ( !numFaces || numVerts < 3 )
{
throw InvalidArgumentException( "MeshAlgo::reorderVertices : Cannot reorder empty mesh." );
}
buildInternalTopology( vertexIds, verticesPerFace, faceToEdgesMap, faceToVerticesMap, edgeToConnectedFacesMap, vertexToFacesMap, faceVaryingOffsets, numFaces, numVerts );
for( EdgeToConnectedFacesMap::const_iterator it = edgeToConnectedFacesMap.begin(); it != edgeToConnectedFacesMap.end(); ++it )
{
if ( it->second.size() > 2 || it->second.size() == 0 )
{
throw InvalidArgumentException( "MeshAlgo::reorderVertices : Cannot reorder non-manifold mesh." );
}
}
VertexToFacesMap::const_iterator vIt0 = vertexToFacesMap.find( id0 );
if( vIt0 == vertexToFacesMap.end() )
{
throw InvalidArgumentException( ( boost::format( "MeshAlgo::reorderVertices : Cannot find vertex %d" ) % id0 ).str() );
}
VertexToFacesMap::const_iterator vIt1 = vertexToFacesMap.find( id1 );
if( vIt1 == vertexToFacesMap.end() )
{
throw InvalidArgumentException( ( boost::format( "MeshAlgo::reorderVertices : Cannot find vertex %d" ) % id1 ).str() );
}
VertexToFacesMap::const_iterator vIt2 = vertexToFacesMap.find( id2 );
if( vIt2 == vertexToFacesMap.end() )
{
throw InvalidArgumentException( ( boost::format( "MeshAlgo::reorderVertices : Cannot find vertex %d" ) % id2 ).str() );
}
FaceSet tmp;
const FaceSet &vtx0Faces = vIt0->second;
const FaceSet &vtx1Faces = vIt1->second;
const FaceSet &vtx2Faces = vIt2->second;
std::set_intersection(
vtx0Faces.begin(), vtx0Faces.end(),
vtx1Faces.begin(), vtx1Faces.end(),
std::inserter( tmp, tmp.end() )
);
FaceSet tmp2;
std::set_intersection(
tmp.begin(), tmp.end(),
vtx2Faces.begin(), vtx2Faces.end(),
std::inserter( tmp2, tmp2.end() )
);
if( tmp2.size() != 1 )
{
throw InvalidArgumentException( ( boost::format( "MeshAlgo::reorderVertices : Vertices %d, %d, and %d do not uniquely define a single polygon" ) % id0 % id1 % id2 ).str() );
}
int currentFace = *tmp2.begin();
Edge currentEdge( id0, id1 );
std::vector<int> faceRemap( numFaces, -1 );
std::vector<VertexId> vertexMap( numVerts, -1 );
std::vector<VertexId> vertexRemap( numVerts, -1 );
std::vector<int> newVerticesPerFace;
std::vector<VertexId> newVertexIds;
std::vector<int> faceVaryingRemap;
int nextVertex = 0;
visitFace(
mesh,
currentFace,
currentEdge,
faceToVerticesMap,
faceToEdgesMap,
faceVaryingOffsets,
edgeToConnectedFacesMap,
vertexMap,
vertexRemap,
newVerticesPerFace,
newVertexIds,
faceVaryingRemap,
faceRemap,
nextVertex
);
assert( (int)vertexMap.size() == numVerts );
assert( (int)vertexRemap.size() == numVerts );
for( int i = 0; i < numVerts; ++i )
//.........这里部分代码省略.........