This is an automated email from the ASF dual-hosted git repository. erans pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-geometry.git
commit 40a40bc73c32815479f191b75ae0c8f954408d31 Merge: b329f9b d7b4a10 Author: Matt Juntunen <[email protected]> AuthorDate: Sun Jul 22 14:26:28 2018 -0400 merging with master .../org/apache/commons/geometry/core/Geometry.java | 18 +- .../apache/commons/geometry/core/GeometryTest.java | 66 ++++ .../geometry/euclidean/threed/Cartesian3D.java | 7 + .../commons/geometry/euclidean/threed/Point3D.java | 21 +- .../euclidean/threed/SphericalCoordinates.java | 312 ++++++++++++++++ .../geometry/euclidean/threed/Vector3D.java | 46 +-- .../geometry/euclidean/twod/Cartesian2D.java | 7 + .../commons/geometry/euclidean/twod/Point2D.java | 19 +- .../geometry/euclidean/twod/PolarCoordinates.java | 262 ++++++++++++++ .../commons/geometry/euclidean/twod/Vector2D.java | 19 +- .../geometry/euclidean/oned/Vector1DTest.java | 16 + .../geometry/euclidean/threed/Cartesian3DTest.java | 45 +++ .../geometry/euclidean/threed/Point3DTest.java | 24 +- .../euclidean/threed/SphericalCoordinatesTest.java | 399 +++++++++++++++++++++ .../geometry/euclidean/threed/Vector3DTest.java | 58 ++- .../geometry/euclidean/twod/Cartesian2DTest.java | 50 ++- .../geometry/euclidean/twod/Point2DTest.java | 31 +- .../euclidean/twod/PolarCoordinatesTest.java | 362 +++++++++++++++++++ .../geometry/euclidean/twod/Vector2DTest.java | 47 ++- .../geometry/spherical/SphericalCoordinates.java | 394 -------------------- .../commons/geometry/spherical/oned/ArcsSet.java | 4 +- .../geometry/spherical/oned/LimitAngle.java | 2 +- .../commons/geometry/spherical/oned/S1Point.java | 54 ++- .../commons/geometry/spherical/package-info.java | 23 -- .../commons/geometry/spherical/twod/Circle.java | 2 +- .../commons/geometry/spherical/twod/S2Point.java | 113 +++--- .../spherical/SphericalCoordinatesTest.java | 83 ----- .../geometry/spherical/SphericalTestUtils.java | 2 +- .../geometry/spherical/oned/LimitAngleTest.java | 2 +- .../geometry/spherical/oned/S1PointTest.java | 4 +- .../geometry/spherical/twod/CircleTest.java | 10 +- .../geometry/spherical/twod/S2PointTest.java | 20 +- .../spherical/twod/SphericalPolygonsSetTest.java | 4 +- 33 files changed, 1799 insertions(+), 727 deletions(-) diff --cc commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java index 41e47e8,078a5d3..f290fdd --- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java +++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java @@@ -74,6 -70,12 +71,9 @@@ public final class Vector3D extends Car } }; + /** Serializable UID */ + private static final long serialVersionUID = 20180710L; + - /** Error message when norms are zero. */ - private static final String ZERO_NORM_MSG = "Norm is zero"; - /** Simple constructor. * Build a vector from its coordinates * @param x abscissa @@@ -117,47 -127,9 +117,33 @@@ /** {@inheritDoc} */ @Override public double getNormInf() { - return Math.max(Math.max(Math.abs(getX()), Math.abs(getY())), Math.abs(getZ())); + return Vectors.normInf(getX(), getY(), getZ()); + } + + /** {@inheritDoc} */ + @Override + public double getMagnitude() { + return getNorm(); + } + + /** {@inheritDoc} */ + @Override + public double getMagnitudeSq() { + return getNormSq(); + } + + /** {@inheritDoc} */ + @Override + public Vector3D withMagnitude(double magnitude) { + final double invNorm = 1.0 / nonZeroNorm(); + + return new Vector3D( + magnitude * getX() * invNorm, + magnitude * getY() * invNorm, + magnitude * getZ() * invNorm + ); } - /** Get the azimuth of the vector. - * @return azimuth (α) of the vector, between -π and +π - */ - public double getAlpha() { - return Math.atan2(getY(), getX()); - } - - /** Get the elevation of the vector. - * @return elevation (δ) of the vector, between -π/2 and +π/2 - */ - public double getDelta() { - return Math.asin(getZ() / getNorm()); - } - /** {@inheritDoc} */ @Override public Vector3D add(Vector3D v) { diff --cc commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java index 819ba2b,36c300e..3d6fa79 --- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java +++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java @@@ -68,6 -64,12 +65,9 @@@ public final class Vector2D extends Car } }; + /** Serializable UID */ + private static final long serialVersionUID = 20180710L; + - /** Error message when norms are zero. */ - private static final String ZERO_NORM_MSG = "Norm is zero"; - /** Simple constructor. * @param x abscissa (first coordinate) * @param y ordinate (second coordinate)
