NormalizedGeodeticPoint.java

  1. /* Copyright 2013-2022 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.rugged.utils;

  18. import org.hipparchus.util.MathUtils;
  19. import org.orekit.bodies.GeodeticPoint;

  20. /** Geodetic point whose longitude can be selected with respect to the 2π boundary.
  21.  * @author Luc Maisonobe
  22.  */
  23. public class NormalizedGeodeticPoint extends GeodeticPoint {

  24.     /** Serializable UID. */
  25.     private static final long serialVersionUID = 20141016l;

  26.     /** Normalized longitude. */
  27.     private final double normalizedLongitude;

  28.     /**
  29.      * Build a new instance. The angular coordinates will be normalized
  30.      * to ensure     that the latitude is between ±π/2 and the longitude
  31.      * is between lc-π and lc+π.
  32.      *
  33.      * @param latitude latitude of the point
  34.      * @param longitude longitude of the point
  35.      * @param altitude altitude of the point
  36.      * @param centralLongitude central longitude lc
  37.      */
  38.     public NormalizedGeodeticPoint(final double latitude, final double longitude,
  39.                                    final double altitude, final double centralLongitude) {
  40.         super(latitude, longitude, altitude);
  41.         this.normalizedLongitude = MathUtils.normalizeAngle(longitude, centralLongitude);
  42.     }

  43.     /** Get the longitude.
  44.      * @return longitude, an angular value in the range [lc-π, lc+π],
  45.      * where l₀ was selected at construction
  46.      */
  47.     @Override
  48.     public double getLongitude() {
  49.         return normalizedLongitude;
  50.     }

  51.     /** {@inheritDoc} */
  52.     @Override
  53.     public boolean equals(final Object object) {
  54.         // we override the method just to make it clear that we INTENTIONALLY
  55.         // consider normalized point are just similar to regular points
  56.         return super.equals(object);
  57.     }

  58.     /** {@inheritDoc} */
  59.     @Override
  60.     public int hashCode() {
  61.         // we override the method just to make it clear that we INTENTIONALLY
  62.         // consider normalized point are just similar to regular points
  63.         return super.hashCode();
  64.     }

  65. }