Skip to content

Commit fc3d6be

Browse files
committed
LineSegment: override the toString() method
1 parent 00ef1ad commit fc3d6be

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

jme3-core/src/main/java/com/jme3/math/LineSegment.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2020 jMonkeyEngine
2+
* Copyright (c) 2009-2024 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -720,6 +720,23 @@ public LineSegment clone() {
720720
}
721721
}
722722

723+
/**
724+
* Returns a string representation of the LineSegment, which is unaffected.
725+
* For example, a segment extending from (1,0,0) to (1,1,0) is represented
726+
* by:
727+
* <pre>
728+
* LineSegment [Origin: (1.0, 0.0, 0.0) Direction: (0.0, 1.0, 0.0) Extent: 1.0]
729+
* </pre>
730+
*
731+
* @return the string representation (not null, not empty)
732+
*/
733+
@Override
734+
public String toString() {
735+
return getClass().getSimpleName() + " [Origin: " + origin
736+
+ " Direction: " + direction + " Extent: " + extent + "]";
737+
}
738+
739+
/**
723740
/**
724741
* <p>Evaluates whether a given point is contained within the axis aligned bounding box
725742
* that contains this LineSegment.</p><p>This function is float error aware.</p>

0 commit comments

Comments
 (0)