diff options
author | bubnikv <bubnikv@gmail.com> | 2019-12-10 13:12:17 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-12-10 13:12:17 +0300 |
commit | b12bc5c4d5c2d18ef45c75c00f46364a6728f3c3 (patch) | |
tree | 69fdfcdb5d9578a1c29f52089589df08b7ef857b /src/slic3r/GUI/3DScene.hpp | |
parent | 24bbad634a99a4450b3d88e99febcd18bcc51c05 (diff) |
Optimization in GLCanvas3D::reload_scene():
Use sorting and binary search instead of linear search.
O(n log n) versus O(n^2)
Diffstat (limited to 'src/slic3r/GUI/3DScene.hpp')
-rw-r--r-- | src/slic3r/GUI/3DScene.hpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 8c5040eee..5d559c246 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -303,6 +303,8 @@ public: int instance_id; bool operator==(const CompositeID &rhs) const { return object_id == rhs.object_id && volume_id == rhs.volume_id && instance_id == rhs.instance_id; } bool operator!=(const CompositeID &rhs) const { return ! (*this == rhs); } + bool operator< (const CompositeID &rhs) const + { return object_id < rhs.object_id || (object_id == rhs.object_id && (volume_id < rhs.volume_id || (volume_id == rhs.volume_id && instance_id < rhs.instance_id))); } }; CompositeID composite_id; // Fingerprint of the source geometry. For ModelVolumes, it is the ModelVolume::ID and ModelInstanceID, |