Java Array Divide divVec2(final float[] result, final float[] vector, final float scale)

Here you can find the source of divVec2(final float[] result, final float[] vector, final float scale)

Description

Divides a vector by param using given result float[], result = vector / scale

License

Open Source License

Parameter

Parameter Description
result vector for the result, may be vector (in-place)
vector input vector
scale single scale constant for all vector components

Return

result vector for chaining

Declaration

public static float[] divVec2(final float[] result, final float[] vector, final float scale) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w  w w .j a  v a  2 s. co m
     * Divides a vector by param using given result float[], result = vector / scale
     * @param result vector for the result, may be vector (in-place)
     * @param vector input vector
     * @param scale single scale constant for all vector components
     * @return result vector for chaining
     */
    public static float[] divVec2(final float[] result, final float[] vector, final float scale) {
        result[0] = vector[0] / scale;
        result[1] = vector[1] / scale;
        return result;
    }

    /**
     * Divides a vector by param using given result float[], result = vector / scale
     * @param result vector for the result, may be vector (in-place)
     * @param vector input vector
     * @param scale 2 component scale constant for each vector component
     * @return result vector for chaining
     */
    public static float[] divVec2(final float[] result, final float[] vector, final float[] scale) {
        result[0] = vector[0] / scale[0];
        result[1] = vector[1] / scale[1];
        return result;
    }
}

Related

  1. divideIntoChunks(Object[] objs, int chunkSize)
  2. divideNonSingular(int[] array1, int[] array2)
  3. divideVector(float[] resultVec, float divisor)
  4. divideVectors(float[] v1, float[] v2)
  5. divisors(final int n, final int[] buffer)