/*
    Copyright 2017 Arnaud Guyon

    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.
 */
package fr.arnaudguyon.smartgl.math;

/**
 * Created by aguyon on 18.01.17.
 */

public class Vector3D {

    private float[] mVector = new float[3];

    public Vector3D(float x, float y, float z) {
        mVector[0] = x;
        mVector[1] = y;
        mVector[2] = z;
    }

    public float[] getArray() {
        return mVector;
    }

    public void normalize() {
        float norm = (float) Math.sqrt(mVector[0]*mVector[0] + mVector[1]*mVector[1] + mVector[2]*mVector[2]);
        if (norm > 0) {
            mVector[0] /= norm;
            mVector[1] /= norm;
            mVector[2] /= norm;
        } else {
            mVector[0] = 1;
            mVector[1] = 0;
            mVector[2] = 0;
        }
    }

}

@@ -627,16 +627,60 @@
 .math;%0A%0A
+import android.support.annotation.NonNull;%0A%0A
 /**%0A * C
@@ -990,12 +990,16 @@
 lic 
-void
+Vector3D
  nor
@@ -1337,24 +1337,24 @@
 tor%5B2%5D = 0;%0A
-
         %7D%0A  
@@ -1351,16 +1351,565 @@
       %7D%0A
+        return this;%0A    %7D%0A%0A    public float dot(@NonNull Vector3D other) %7B%0A        return (mVector%5B0%5D * other.mVector%5B0%5D) + (mVector%5B1%5D * other.mVector%5B1%5D) + (mVector%5B2%5D * other.mVector%5B2%5D);%0A    %7D%0A%0A    public Vector3D add(@NonNull Vector3D other) %7B%0A        mVector%5B0%5D += other.mVector%5B0%5D;%0A        mVector%5B1%5D += other.mVector%5B1%5D;%0A        mVector%5B2%5D += other.mVector%5B2%5D;%0A        return this;%0A    %7D%0A    public Vector3D multiply(float scale) %7B%0A        mVector%5B0%5D *= scale;%0A        mVector%5B1%5D *= scale;%0A        mVector%5B2%5D *= scale;%0A        return this;%0A
     %7D%0A%0A%7D

Add Vector3D methods