Skip to content

Commit

Permalink
add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 25, 2024
1 parent 5849ddd commit de63222
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ public static double getRelDistance3D(Location from, Location to) {
return getDistance3D(fromX - toX, from.y() - to.y(), fromZ - toZ);
}

/**
* Returns the Euclidean distance of a triangle with sides {@code x}, {@code y} and {@code z}
* - sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>&nbsp;+<i>z</i><sup>2</sup>)<br/>
* avoiding intermediate overflow or underflow.
*
* <ul>
* <li> If any argument is infinite, then the result is positive infinity.</li>
* <li> else, if any argument is NaN then the result is NaN.</li>
* </ul>
*
* @param x a value
* @param y a value
* @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>&nbsp;+<i>z</i><sup>2</sup>)<br/>
*/
public static double getDistance3D(final double x, final double y, final double z) {
if (Double.isInfinite(x) || Double.isInfinite(y) || Double.isInfinite(z)) {
return Double.POSITIVE_INFINITY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ public static double getRelDistance3D(Location from, Location to) {
return getDistance3D(fromX - toX, from.getY() - to.getY(), fromZ - toZ);
}

/**
* Returns the Euclidean distance of a triangle with sides {@code x}, {@code y} and {@code z}
* - sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>&nbsp;+<i>z</i><sup>2</sup>)<br/>
* avoiding intermediate overflow or underflow.
*
* <ul>
* <li> If any argument is infinite, then the result is positive infinity.</li>
* <li> else, if any argument is NaN then the result is NaN.</li>
* </ul>
*
* @param x a value
* @param y a value
* @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>&nbsp;+<i>z</i><sup>2</sup>)<br/>
*/
public static double getDistance3D(final double x, final double y, final double z) {
if (Double.isInfinite(x) || Double.isInfinite(y) || Double.isInfinite(z)) {
return Double.POSITIVE_INFINITY;
Expand Down

0 comments on commit de63222

Please sign in to comment.