MeshLib C++ Docs
Loading...
Searching...
No Matches

Structure to map old mesh BitSets to new. More...

#include <MRMesh/MRBooleanOperation.h>

Classes

struct  Maps

Public Types

enum class  MapObject { A , B , Count }
 Input object index enum. More...

Public Member Functions

 BooleanResultMapper ()=default
FaceBitSet map (const FaceBitSet &oldBS, MapObject obj) const
 Returns faces bitset of result mesh corresponding input one.
VertBitSet map (const VertBitSet &oldBS, MapObject obj) const
 Returns vertices bitset of result mesh corresponding input one.
EdgeBitSet map (const EdgeBitSet &oldBS, MapObject obj) const
 Returns edges bitset of result mesh corresponding input one.
UndirectedEdgeBitSet map (const UndirectedEdgeBitSet &oldBS, MapObject obj) const
 Returns undirected edges bitset of result mesh corresponding input one.
FaceBitSet newFaces () const
 Returns only new faces that are created during boolean operation.
FaceBitSet filteredOldFaceBitSet (const FaceBitSet &oldBS, MapObject obj) const
 returns updated oldBS leaving only faces that has corresponding ones in result mesh
FaceMap getNew2OldFaceMap (MapObject obj) const
 returns map: new_face_id->old_obj_face_id for faces from
const Maps & getMaps (MapObject index) const

Public Attributes

std::array< Maps, size_t(MapObject::Count)> maps

Detailed Description

Structure to map old mesh BitSets to new.

Structure to easily map topology of MR::boolean input meshes to result mesh

This structure allows to map faces, vertices and edges of mesh A and mesh B input of MR::boolean to result mesh topology primitives

// find the faces of the result produced by each input sphere, and the faces the cut created
MR::FaceBitSet facesOfSphere1 = mapper.map( sphere1.topology.getValidFaces(), MapObject::A );
MR::FaceBitSet facesOfSphere2 = mapper.map( sphere2.topology.getValidFaces(), MapObject::B );
MR::FaceBitSet newFaces = mapper.newFaces();
std::cout << "faces from sphere1: " << facesOfSphere1.count() << "\n"
<< "faces from sphere2: " << facesOfSphere2.count() << "\n"
<< "faces created by the cut: " << newFaces.count() << std::endl;
// map one particular face of sphere1 forward: the cut can split it in several faces of the
// result, or drop it completely if that part of sphere1 is not in the result
MR::FaceId faceOfSphere1( 793 );
MR::FaceBitSet oneFace;
oneFace.autoResizeSet( faceOfSphere1 );
MR::FaceBitSet producedFaces = mapper.map( oneFace, MapObject::A );
std::cout << "face " << faceOfSphere1 << " of sphere1 produced " << producedFaces.count() << " faces of the result:";
for ( MR::FaceId f : producedFaces )
std::cout << ' ' << f;
std::cout << std::endl;
// and backward: the face of sphere1 each face of the result came from
// (invalid id for the faces that came from sphere2)
MR::FaceMap new2OldFaces = mapper.getNew2OldFaceMap( MapObject::A );
MR::FaceId resultFace = producedFaces.find_first();
std::cout << "face " << resultFace << " of the result came from face " << new2OldFaces[resultFace] << " of sphere1" << std::endl;
See also
MR::boolean

Member Enumeration Documentation

◆ MapObject

Input object index enum.

Enumerator
A 
B 
Count 

Constructor & Destructor Documentation

◆ BooleanResultMapper()

MR::BooleanResultMapper::BooleanResultMapper ( )
default

Member Function Documentation

◆ filteredOldFaceBitSet()

FaceBitSet MR::BooleanResultMapper::filteredOldFaceBitSet ( const FaceBitSet & oldBS,
MapObject obj ) const

returns updated oldBS leaving only faces that has corresponding ones in result mesh

◆ getMaps()

const Maps & MR::BooleanResultMapper::getMaps ( MapObject index) const
inlinenodiscard

◆ getNew2OldFaceMap()

FaceMap MR::BooleanResultMapper::getNew2OldFaceMap ( MapObject obj) const
nodiscard

returns map: new_face_id->old_obj_face_id for faces from

Parameters
obj

◆ map() [1/4]

EdgeBitSet MR::BooleanResultMapper::map ( const EdgeBitSet & oldBS,
MapObject obj ) const

Returns edges bitset of result mesh corresponding input one.

◆ map() [2/4]

FaceBitSet MR::BooleanResultMapper::map ( const FaceBitSet & oldBS,
MapObject obj ) const

Returns faces bitset of result mesh corresponding input one.

◆ map() [3/4]

UndirectedEdgeBitSet MR::BooleanResultMapper::map ( const UndirectedEdgeBitSet & oldBS,
MapObject obj ) const

Returns undirected edges bitset of result mesh corresponding input one.

◆ map() [4/4]

VertBitSet MR::BooleanResultMapper::map ( const VertBitSet & oldBS,
MapObject obj ) const

Returns vertices bitset of result mesh corresponding input one.

◆ newFaces()

FaceBitSet MR::BooleanResultMapper::newFaces ( ) const

Returns only new faces that are created during boolean operation.

Member Data Documentation

◆ maps

std::array<Maps, size_t( MapObject::Count )> MR::BooleanResultMapper::maps

The documentation for this struct was generated from the following file: