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

Vector angle calculations, basic test package #11

Merged
merged 4 commits into from
Jun 7, 2015

Conversation

FortressBuilder
Copy link
Contributor

Changes

  • Added angle and angleCos methods to Vector classes. These return the angle and the cosinus of the angle, respectively, of two vectors. The angle is in radians.
  • Added static negate methods to Vector classes.
  • Removed the commas from and added whitespace to the Quaternion and AngleAxis toString methods (so they are consistent with the Vector and Matrix classes).
  • Added org.joml.test package with some simple test classes. At the moment only angle is tested.

Issues

  • The angle method in the Vector classes returns the angle in radians. However, I did see some methods that took degrees in their parameters. I decided to let the user choose whether they want to have it in radians or convert it to degrees. Is this correct? Which angle unit system should I use?

httpdigest added a commit that referenced this pull request Jun 7, 2015
Vector angle calculations, basic test package
@httpdigest httpdigest merged commit 316495b into JOML-CI:master Jun 7, 2015
@httpdigest
Copy link
Member

Thank you for your additions!

@FortressBuilder
Copy link
Contributor Author

Thanks for including them! However, regarding the issue above: Should I use radians or degrees on further changes?

@httpdigest
Copy link
Member

Regarding degrees vs. radians:
You are right, the angle parameters of most methods use degrees.

This is debatable, but was chosen for two reasons:

  • to be compatible with the semantics of GLU and GL functions
  • most typical angles in rotate() and the field-of-view in perspective() specified by the user can use "typical"/"nice" degree values, such as rotating about 90 degrees or having a field-of-view of 45 or 60 degrees, instead of using fractions of PI (or having to do Math.toRadians)

However, methods which return angles should use the "mathematical" variant of radians in order for those results to be chained to other methods also operating with radians.
But we must make it very clear in the JavaDocs that this is the case.

@FortressBuilder
Copy link
Contributor Author

Okay, thanks. Maybe this should be added to the Design wiki page as well.

Edit: What about overloaded methods? perspective using degrees and perspectiveRad radians?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants