Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions source/MRMesh/MRRegionBoundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,20 @@ FaceBitSet getIncidentFaces( const MeshTopology & topology, const VertBitSet & v
return topology.getValidFaces() - getInnerFaces_( topology, topology.getValidVerts() - verts );
}

FaceBitSet getNeighborFaces( const MeshTopology& topology, const UndirectedEdgeBitSet& edges )
{
MR_TIMER
FaceBitSet res( topology.faceSize() );
for ( auto ue : edges )
{
if ( auto l = topology.left( ue ) )
res.set( l );
if ( auto r = topology.right( ue ) )
res.set( r );
}
return res;
}

FaceBitSet getInnerFaces( const MeshTopology & topology, const VertBitSet & verts )
{
MR_TIMER
Expand Down Expand Up @@ -412,15 +426,7 @@ static VertBitSet getIncidentVerts_( const MeshTopology & topology, const Undire
FaceBitSet getIncidentFaces( const MeshTopology & topology, const UndirectedEdgeBitSet & edges )
{
MR_TIMER
FaceBitSet res( topology.faceSize() );
for ( auto ue : edges )
{
if ( auto l = topology.left( ue ) )
res.set( l );
if ( auto r = topology.right( ue ) )
res.set( r );
}
return res;
return getIncidentFaces( topology, getIncidentVerts_( topology, edges ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New implementation is right, but let us preserve the old one as function getNeighborFaces

}

static VertBitSet getInnerVerts_( const MeshTopology & topology, const UndirectedEdgeBitSet & edges )
Expand Down
2 changes: 2 additions & 0 deletions source/MRMesh/MRRegionBoundary.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ namespace MR
[[nodiscard]] MRMESH_API VertBitSet getIncidentVerts( const MeshTopology & topology, const UndirectedEdgeBitSet & edges );
// composes the set of all faces incident to given edges
[[nodiscard]] MRMESH_API FaceBitSet getIncidentFaces( const MeshTopology & topology, const UndirectedEdgeBitSet & edges );
// composes the set of all left and right faces of given edges
[[nodiscard]] MRMESH_API FaceBitSet getNeighborFaces( const MeshTopology& topology, const UndirectedEdgeBitSet& edges );
// composes the set of all edges with all their vertices in given set
[[nodiscard]] MRMESH_API UndirectedEdgeBitSet getInnerEdges( const MeshTopology & topology, const VertBitSet& verts );
// composes the set of all edges having both left and right in given region
Expand Down
2 changes: 1 addition & 1 deletion source/MRMesh/MRSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ void deserializeViaVerticesFromJson( const Json::Value& root, UndirectedEdgeBitS
edges.resize( root["size"].asInt() );
auto bin = decode64( root["vertpairs"].asString() );

for ( size_t i = 0; i + 8 < bin.size(); i += 8 )
for ( size_t i = 0; i < bin.size(); i += 8 )
{
VertId o, d;
static_assert( sizeof( VertId ) == 4 );
Expand Down