Skip to content

Commit 3dad2bd

Browse files
authored
optimize getWorldBox() when transform is identity (#5690)
1 parent 89b2136 commit 3dad2bd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

source/MRMesh/MRObjectLinesHolder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Box3f ObjectLinesHolder::getWorldBox( ViewportId id ) const
115115
auto & cache = worldBox_[id];
116116
if ( auto v = cache.get( worldXf ) )
117117
return *v;
118-
const auto box = polyline_->computeBoundingBox( &worldXf );
118+
const auto box = worldXf == AffineXf3f{} ? getBoundingBox() : polyline_->computeBoundingBox( &worldXf );
119119
cache.set( worldXf, box );
120120
return box;
121121
}

source/MRMesh/MRObjectMeshHolder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ Box3f ObjectMeshHolder::getWorldBox( ViewportId id ) const
617617
auto & cache = worldBox_[id];
618618
if ( auto v = cache.get( worldXf ) )
619619
return *v;
620-
const auto box = data_.mesh->computeBoundingBox( &worldXf );
620+
const auto box = worldXf == AffineXf3f{} ? getBoundingBox() : data_.mesh->computeBoundingBox( &worldXf );
621621
cache.set( worldXf, box );
622622
return box;
623623
}

source/MRMesh/MRObjectPointsHolder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Box3f ObjectPointsHolder::getWorldBox( ViewportId id ) const
188188
auto & cache = worldBox_[id];
189189
if ( auto v = cache.get( worldXf ) )
190190
return *v;
191-
const auto box = points_->computeBoundingBox( &worldXf );
191+
const auto box = worldXf == AffineXf3f{} ? getBoundingBox() : points_->computeBoundingBox( &worldXf );
192192
cache.set( worldXf, box );
193193
return box;
194194
}

0 commit comments

Comments
 (0)