-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Since the library didn't really exist yet before this point, we didn't really have to work with PR's. One downside is that you can't really review to work done in the same way though -- so have this 'issue' instead.
Line 403 in 4eb68c5
| printf("\rError adding mesh\n"); |
- You really don't want print statements in a library! -- At least not ones that aren't opt-in (opt-out by default).
I've noticed we're importing spdlog anyway, maybe should make use of that to make this into a debug thing.
Line 347 in 4eb68c5
| for (size_t i = 0; i < vertices.size(); ++i) |
- You can use
ranges::enumeratehere instead, I think.
Line 20 in 4eb68c5
| throw std::runtime_error("Vertices should be <float, float, float> and indices should be (grouped by face as) <int, int, int>."); |
Line 38 in 4eb68c5
| throw std::runtime_error("Couldn't unwrap UV's!"); |
- These aren't caught in Uranium when called (see the review there...)
Line 98 in 4eb68c5
| float best_outlier_angle = 1.0; |
Line 103 in 4eb68c5
| float face_best_angle = -1.0f; |
- I know this'll be fine in practice, but I always get a little antsy if I see 'limit' values that could actually occur
(like, it's technically possible to have a dot-product of 1.0 between two vectors).
It's probably better to have something that's a little bigger than |1.0| exactly -- I might even have gone with(-)numeric_limits<float>::infinity().
Line 101 in 4eb68c5
| for (auto iterator = unprocessed_faces.begin; iterator != unprocessed_faces.end; ++iterator) |
- See https://deepwiki.com/ericniebler/range-v3/4.3-take-drop-and-slice-views#slice-views for an alternative.
Line 202 in 4eb68c5
| for (auto iterator = projected_faces_groups.begin(); iterator != projected_faces_groups.end(); ++iterator) |
- You can use structured binding to get (references to) both the key and value of an iterated map-item like so;
for(auto [key, value] : projected_faces_groups) { ... }
(Also;keyandvaluewill both be refs, no need to putauto&that'll just confuse the compiler.)
Line 255 in 4eb68c5
| if (assigned1) |
Line 286 in 4eb68c5
| if (! assigned1) |
- These are blocks with repeated code. It's not too bad, but consider something like;
Then for either block you can use something like;
constexpr bool unassigned = false auto face_struct_list = { {face.i1, unassigned, new_indices_groups.find(face.i1) } {face.i2, unassigned, new_indices_groups.find(face.i2) } {face.i3, unassigned, new_indices_groups.find(face.i3) } }ranges::for_each(face_struct_list, [](auto& tuple) { auto [idx, assigned, it] = tuple; // ... rest of loop-code });
Metadata
Metadata
Assignees
Labels
No labels