Java Vector Divide vectorDiv2D(float[] array, int vectorIndex, float scale)

Here you can find the source of vectorDiv2D(float[] array, int vectorIndex, float scale)

Description

This method divides the given 2D vector by the give scale value.

License

Apache License

Parameter

Parameter Description
array The array containing the vector of interest.
vectorIndex This is the index of the vector in the array.
scale The scale value to divide the vector by.

Declaration

public static void vectorDiv2D(float[] array, int vectorIndex, float scale) 

Method Source Code

//package com.java2s;
/* /* ww  w  .  ja v  a 2 s .  c o m*/
 * Copyright 2014 Topeka Labs.
 *
 * Licensed 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 {
    /**
     * This method divides the given 2D vector by the give scale value.
     * @param array The array containing the vector of interest.
     * @param vectorIndex This is the index of the vector in the array.
     * @param scale The scale value to divide the vector by.
     */
    public static void vectorDiv2D(float[] array, int vectorIndex, float scale) {
        int tempIndex = 2 * vectorIndex;
        array[tempIndex] /= scale;
        array[tempIndex + 1] /= scale;
    }
}