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

math classes should override toString() #2246

Closed
stephengold opened this issue Apr 21, 2024 · 0 comments · Fixed by #2253
Closed

math classes should override toString() #2246

stephengold opened this issue Apr 21, 2024 · 0 comments · Fixed by #2253
Assignees
Milestone

Comments

@stephengold
Copy link
Member

Currently, when you print a com.jme3.math.Triangle using System.out.println(t), you get an opaque identifier generated by Object.toString(), such as "com.jme3.math.Triangle@5b33a14a".

For debugging, it would be helpful to override toString() so that Triangle.toString() would generate something like

Triangle [P1: (-0.22671932, 0.5148976, -0.52107906)  
             P2: (-0.22671932, 0.014897585, -0.52107906)
             P3: (-0.22671932, 0.014897585, -0.45209116)]

If the override were in "AbstractTriangle.java" then it would benefit other implementations of AbstractTriangle (though I'm currently not aware of any).

Similar enhancements should also be made to other com.jme3.math classes, such as Line, LineSegment, and Rectangle.

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

Successfully merging a pull request may close this issue.

2 participants