Implement scalar Point operations#71
Conversation
|
Thank you for this! The reason it wasn't implemented is that scaling a point doesn't make geometric sense. Perhaps translation (addition) does, though. I'm wondering what your use case is here. :-) (Don't mind the CI failures, it's a problem on the main branch, I'm fixing it.) |
|
One of my use cases is calculating the center of a bounding box. let center = 0.5 * bounds.min + 0.5 * bounds.max;Another example would be calculating the vertex "center of mass" (i.e. the average of all vertices). |
|
For bounding boxes, I would recommend using Vertex average is interesting. I'm wondering if it makes sense to have specific functionality for it, but there don't seem to be any specific prior art in the ecosystem, and I'm guessing that a generic implementation may not be sufficient in many cases, like if you wanted a scaled or weighted average. I think I've talked myself into this. :-) |
|
#69 went in squashed and with a merge commit, so this may need rebasing. Sorry for the churn. |
No worries, I'll rebase it soon.
I'm using 3D bounds. |
f1fdbdf to
51f7a7e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #71 +/- ##
=======================================
Coverage 99.30% 99.31%
=======================================
Files 22 22
Lines 5919 5946 +27
=======================================
+ Hits 5878 5905 +27
Misses 41 41 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
simonask
left a comment
There was a problem hiding this comment.
Looks great, I'll add a CHANGELOG entry and merge ✨
Implement scalar operations similar to
Vector. I saw there was a test which stated, that scalar multiplication should not compile. I decided to implement it anyway, because I don't really see a reason against it.Addition of two points was also implemented.
Fixes #70
Note: This PR is based on #69, so it should be merged after #69 is merged.