Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javacpp-port: operators for tdme/math/* #2

Closed
andreasdr opened this issue Jun 30, 2018 · 3 comments
Closed

javacpp-port: operators for tdme/math/* #2

andreasdr opened this issue Jun 30, 2018 · 3 comments

Comments

@andreasdr
Copy link
Member

JAVA does not support operators. C++ does.

Implement operators for tdme/math/*, e.g. Vector3
All the math is in place by inline methods and should even just be called when implementing operators.

@andreasdr
Copy link
Member Author

Examples would for Vector3 would be:

Vector3 a + Vector3 b
auto c=a.clone().add(b); return c;

Vector3 a - Vector3 b
auto c=a.clone().sub(b); return c;

Vector3 a * float b
auto c=a.clone().scale(b); return c;

Vector3 a * Vector3 b
auto c=a.clone().scale(b); return c;

Vector3 a / float b
auto c=a.clone().scale(1.0f / b); return c;

Vector3 a / Vector3 b
vector3 bInverted(1.0f / b[0], 1.0f / b[1], 1.0f / b[2]); auto c=a.clone().scale(bInverted); return c;

+=,-=,*=,/= would be interessting too.

Vector2, Vector4, Quaternion and Matrix are similar, but I can also provide a list if required.

@lukeseuff
Copy link

Do you still need this done?

@andreasdr
Copy link
Member Author

Hi thank you very much for asking, a colleague is already working on it. If there is any reason to do so I will come back to you.

andreasdr pushed a commit that referenced this issue Feb 3, 2020
andreasdr pushed a commit that referenced this issue Feb 3, 2020
andreasdr pushed a commit that referenced this issue Feb 3, 2020
- add mathematical methods add(const Vector4& v), sub(const Vector4& v), equals(const Vector4& v), and equals(const Vector4& v, float tolerance) to class Vector4
- add same set of operators as for Vector2 and Vector3 to class Vector4
andreasdr pushed a commit that referenced this issue Feb 3, 2020
andreasdr pushed a commit that referenced this issue Feb 3, 2020
andreasdr pushed a commit that referenced this issue Feb 3, 2020
andreasdr added a commit that referenced this issue Feb 3, 2020
Merge implementation of issue #2
andreasdr added a commit that referenced this issue Feb 3, 2020
… just need to check m * m and q * q order and maybe m*= m and q *= q
andreasdr added a commit that referenced this issue Nov 16, 2020
Tepilogic added a commit that referenced this issue Jan 28, 2021
andreasdr added a commit that referenced this issue Feb 5, 2021
andreasdr added a commit that referenced this issue Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants