Comments (10)
That's most definitely a bug, yes. Are you able to make a pull request?
from mathfu.
Had look at the issue, but could not find where the operator overload is declared. I was expecting something along the lines of:
inline Vector<float, 2>& operator/=(const float &s, const Vector<float, 2>& v)
Am I missing something?
from mathfu.
https://github.com/google/mathfu/blob/master/include/mathfu/vector.h#L417
https://github.com/google/mathfu/blob/master/include/mathfu/vector_2.h#L102
https://github.com/google/mathfu/blob/master/include/mathfu/vector_2.h#L118
https://github.com/google/mathfu/blob/master/include/mathfu/vector_2.h#L155
etc.
We have various overloads for each specialized vector e.g vec2, vec3, vec4
etc.
On Tue, Sep 15, 2015 at 10:06 AM, Daniel Monteiro [email protected]
wrote:
Had look at the issue, but could not find where the operator overload is
declared. I was expecting something along the lines of:
inline Vector<float, 2>& operator/=(const float &s, const Vector<float,
2>& v)
Am I missing something?—
Reply to this email directly or view it on GitHub
#8 (comment).
from mathfu.
Precisely. By grep
ping thru the code, all I could find was overloads dealing with Vec2/Vec2 and Vec2/scalar, but not for scalar/Vec2 (which, in effect, would be scalar * Vec2^(-1) ).
Still, by far, the last few days of digging have been quite fascinating.
from mathfu.
That will teach me to not read your original message.
Is it possible that you're ending up in
https://github.com/google/mathfu/blob/master/include/mathfu/vector.h#L670
? It looks like that code is wrong since it should only accept a scalar on
the right-hand side of the expression. i.e scalar / vector = undefined
https://en.wikibooks.org/wiki/Fundamentals_of_Physics/Vectors, vector /
scalar = piecewise division of each element in the vector.
What code have you written that is problematic, any chance you could share
a snippet?
On Tue, Sep 15, 2015 at 10:31 AM, Daniel Monteiro [email protected]
wrote:
Precisely. By grepping thru the code, all I could find was overloads
dealing with Vec2/Vec2 and Vec2/scalar, but not for scalar/Vec2 (which, in
effect, would be scalar * Vec2^(-1) ).Still, by far, the last few days of digging have been quite fascinating.
—
Reply to this email directly or view it on GitHub
#8 (comment).
from mathfu.
Not really mine. I'm just trying to learn from it.
I was unsure of what 1.0/vec2 would mean until I threw it at Wolfram Alpha ( {2.0, 3.0}^-1 got me {1.0/2.0, 1.0/3.0}). Me and my friends were baffled by his outcome.
By doing this on the generic vector wouldn't it be too expensive to go component-by-component? Maybe this couldn't be more efficiently (at the cost of some repetition) dealt at the more specific vectors? Or maybe it would result in unwanted duplicity of effort?
Or even, does it make sense to have it as a general proposition?
from mathfu.
I would really prefer to not have MathFu include operators that aren't well
defined.
We have specialized implementations of scalar divide for each vector type
which use SIMD when it's available. As I mentioned scalar / vector sounds
broken.
On Tue, Sep 15, 2015 at 11:12 AM, Daniel Monteiro [email protected]
wrote:
Not really mine. I'm just trying to learn from it.
I was unsure of what 1.0/vec2 would mean until I threw it at Wolfram Alpha
( {2.0, 3.0}^-1 got me {1.0/2.0, 1.0/3.0}). Me and my friends were baffled
by his outcome.By doing this on the generic vector wouldn't it be too expensive to go
component-by-component? Maybe this couldn't be more efficiently (at the
cost of some repetition) dealt at the more specific vectors? Or maybe it
would result in unwanted duplicity of effort?Or even, does it make sense to have it as a general proposition?
—
Reply to this email directly or view it on GitHub
#8 (comment).
from mathfu.
I agree. Makes a lot more sense
Maybe @batesj can provide us with more details on his use? Maybe we can suggest alternatives? IDK
from mathfu.
I would have been happy if my code didn't compile, so feel free to delete the scalar / vector operator.
What I expected was component-wise divide either through implicit construction or directly:
1.0 / vec2 == vec2(1.0) / vec2 == vec2(1.0, 1.0) / vec2
from mathfu.
from mathfu.
Related Issues (20)
- Matrix vector product question.
- SIMD detection doesn't work on MSVC x64 targets HOT 5
- Projection function HOT 6
- Google_Mathfu failed with warning C4305 when build with MSVC HOT 3
- Expose GetColumn in Matrix
- Remove "vectorial" lib external dependency? HOT 2
- Support for double vectors/matrices (with SIMD)?
- matrix_4x4_simd.h is not included by default HOT 2
- Quaternions are 32 bytes due to alignment constraints instead of 16 bytes
- Api description in GLSL Mappings for typedef Matrix< float, 4, 4 > HOT 1
- CMAKE_SOURCE_DIR vs. CMAKE_CURRENT_SOURCE_DIR usage in studio 3.4 timeframe
- Google_MathFu failed to build due to error C1083 with MSVC on windows HOT 1
- Google_Mathfu failed with warning C4100 when build with MSVC
- When SIMD build disabled, Vector<T, Dims> miss some fundamental methods HOT 1
- Perspective projection matrix (what device coordinates is it mapping to?)
- Is this page wrong? I think there should be no parentheses. HOT 2
- method HadamardProduct of Matrix can not compile
- Bug on Quaternion::LookAt()
- Compile flag Not Updated HOT 1
- When building Google_MathFu emits warning C2220 on MSVC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathfu.