OSDN Git Service

removed tmp() from Vector interface
authorMario Zechner <contact@badlogicgames.com>
Tue, 19 Feb 2013 14:53:13 +0000 (15:53 +0100)
committerMario Zechner <contact@badlogicgames.com>
Tue, 19 Feb 2013 14:53:13 +0000 (15:53 +0100)
gdx/src/com/badlogic/gdx/math/Vector.java

index 766092b..f03add8 100644 (file)
 
 package com.badlogic.gdx.math;
 
-/** Encapsulates a general vector. Allows chaining operations by returning a reference to itself in all modification methods.
- * See {@link Vector2} and {@link Vector3} for specific implementations.
+/** Encapsulates a general vector. Allows chaining operations by returning a reference to itself in all modification methods. See
+ * {@link Vector2} and {@link Vector3} for specific implementations.
  * @author Xoppa */
 public interface Vector<T extends Vector> {
        /** @return a copy of this vector */
-       T cpy();
+       T cpy ();
+
        /** @return The euclidian length */
-       float len();
+       float len ();
+
        /** @return The squared euclidian length */
-       float len2();
+       float len2 ();
+
        /** Sets this vector from the given vector
         * @param v The vector
         * @return This vector for chaining */
-       T set(T v);
+       T set (T v);
+
        /** Substracts the given vector from this vector.
         * @param v The vector
         * @return This vector for chaining */
-       T sub(T v);
+       T sub (T v);
+
        /** Normalizes this vector
         * @return This vector for chaining */
-       T nor();
+       T nor ();
+
        /** Adds the given vector to this vector
         * @param v The vector
         * @return This vector for chaining */
-       T add(T v);
+       T add (T v);
+
        /** @param v The other vector
         * @return The dot product between this and the other vector */
-       float dot(T v);
+       float dot (T v);
+
        /** Multiplies this vector by a scalar
         * @param scalar The scalar
         * @return This vector for chaining */
-       T mul(float scalar);
+       T mul (float scalar);
+
        /** Multiplies this vector by another vector
         * @return This vector for chaining */
-       T mul(T v);
-       T div(float scalar);
-       T div(T v);
+       T mul (T v);
+
+       T div (float scalar);
+
+       T div (T v);
+
        /** @param v The other vector
         * @return the distance between this and the other vector */
-       float dst(T v);
+       float dst (T v);
+
        /** @param v The other vector
         * @return the squared distance between this and the other vector */
-       float dst2(T v);
-       /** NEVER EVER SAVE THIS REFERENCE! Do not use this unless you are aware of the side-effects, e.g. other methods might call this
-        * as well.
-        * 
-        * @return a temporary copy of this vector. Use with care as this is backed by a single static Vector instance. v1.tmp().add(
-        *         v2.tmp() ) will not work! */
-       T tmp();
+       float dst2 (T v);
+
        /** Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1]. The result is stored
         * in this vector.
         * 
         * @param target The target vector
         * @param alpha The interpolation coefficient
         * @return This vector for chaining. */
-       T lerp(T target, float alpha);
-       
+       T lerp (T target, float alpha);
+
        // TODO: T crs(T v);
 }