Java Array Normalize normLng(double[] latLng)

Here you can find the source of normLng(double[] latLng)

Description

Returns a normalized Lng rectangle shape for the bounding box

License

Apache License

Parameter

Parameter Description
latLng The lat/lon, in radians, lat in position 0, long in position 1

Declaration

public static void normLng(double[] latLng) 

Method Source Code

//package com.java2s;
/**/*  w  ww. ja v  a 2 s.  co  m*/
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    public static final double DEG_180_AS_RADS = Math.PI;

    /**
     * Returns a normalized Lng rectangle shape for the bounding box
     *
     * @param latLng The lat/lon, in radians, lat in position 0, long in position 1
     */
    public static void normLng(double[] latLng) {
        if (latLng[1] > DEG_180_AS_RADS) {
            latLng[1] = -1.0
                    * (DEG_180_AS_RADS - (latLng[1] - DEG_180_AS_RADS));
        } else if (latLng[1] < -DEG_180_AS_RADS) {
            latLng[1] = (latLng[1] + DEG_180_AS_RADS) + DEG_180_AS_RADS;
        }
    }
}

Related

  1. normalizeZscore(double[] x)
  2. normBySortedPointersInverse(double[] d, int[] pointers)
  3. normData(double[] data)
  4. normII(double[] b)
  5. normLat(double[] latLng)
  6. normOf(float[] vector)
  7. normSquareVec2(final float[] vec)
  8. normVector(double[] pos)