Skip to content

math classes should override toString() #2246

@stephengold

Description

@stephengold

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions