improve formatting & rm trailing whitespace (21 files in com.jme3.math)
This commit is contained in:
parent
4c62d5008e
commit
5a2499ccbe
@ -38,7 +38,6 @@ import com.jme3.collision.CollisionResults;
|
|||||||
* A Collidable with a triangular shape.
|
* A Collidable with a triangular shape.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTriangle implements Collidable {
|
public abstract class AbstractTriangle implements Collidable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the location of the first vertex.
|
* Determine the location of the first vertex.
|
||||||
*
|
*
|
||||||
@ -77,8 +76,7 @@ public abstract class AbstractTriangle implements Collidable {
|
|||||||
* @return the number of collisions found
|
* @return the number of collisions found
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int collideWith(Collidable other, CollisionResults results){
|
public int collideWith(Collidable other, CollisionResults results) {
|
||||||
return other.collideWith(this, results);
|
return other.collideWith(this, results);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ import java.io.IOException;
|
|||||||
* @version $Id: ColorRGBA.java,v 1.29 2007/09/09 18:25:14 irrisor Exp $
|
* @version $Id: ColorRGBA.java,v 1.29 2007/09/09 18:25:14 irrisor Exp $
|
||||||
*/
|
*/
|
||||||
public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable {
|
public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable {
|
||||||
|
|
||||||
static final float GAMMA = 2.2f;
|
static final float GAMMA = 2.2f;
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
@ -137,6 +136,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* these values are assumed to be in linear space and stored as is.
|
* these values are assumed to be in linear space and stored as is.
|
||||||
* If you want to assign sRGB values use
|
* If you want to assign sRGB values use
|
||||||
* {@link ColorRGBA#setAsSrgb(float, float, float, float) }
|
* {@link ColorRGBA#setAsSrgb(float, float, float, float) }
|
||||||
|
*
|
||||||
* @param r The red component of this color.
|
* @param r The red component of this color.
|
||||||
* @param g The green component of this <code>ColorRGBA</code>.
|
* @param g The green component of this <code>ColorRGBA</code>.
|
||||||
* @param b The blue component of this <code>ColorRGBA</code>.
|
* @param b The blue component of this <code>ColorRGBA</code>.
|
||||||
@ -152,6 +152,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* Copy constructor creates a new <code>ColorRGBA</code> object, based on
|
* Copy constructor creates a new <code>ColorRGBA</code> object, based on
|
||||||
* a provided color.
|
* a provided color.
|
||||||
|
*
|
||||||
* @param rgba The <code>ColorRGBA</code> object to copy.
|
* @param rgba The <code>ColorRGBA</code> object to copy.
|
||||||
*/
|
*/
|
||||||
public ColorRGBA(ColorRGBA rgba) {
|
public ColorRGBA(ColorRGBA rgba) {
|
||||||
@ -217,6 +218,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>getColorArray</code> retrieves the color values of this
|
* <code>getColorArray</code> retrieves the color values of this
|
||||||
* <code>ColorRGBA</code> as a four element <code>float</code> array in the
|
* <code>ColorRGBA</code> as a four element <code>float</code> array in the
|
||||||
* order: r,g,b,a.
|
* order: r,g,b,a.
|
||||||
|
*
|
||||||
* @return The <code>float</code> array that contains the color components.
|
* @return The <code>float</code> array that contains the color components.
|
||||||
*/
|
*/
|
||||||
public float[] getColorArray() {
|
public float[] getColorArray() {
|
||||||
@ -226,6 +228,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* Stores the current r,g,b,a values into the given array. The given array must have a
|
* Stores the current r,g,b,a values into the given array. The given array must have a
|
||||||
* length of 4 or greater, or an array index out of bounds exception will be thrown.
|
* length of 4 or greater, or an array index out of bounds exception will be thrown.
|
||||||
|
*
|
||||||
* @param store The <code>float</code> array to store the values into.
|
* @param store The <code>float</code> array to store the values into.
|
||||||
* @return The <code>float</code> array after storage.
|
* @return The <code>float</code> array after storage.
|
||||||
*/
|
*/
|
||||||
@ -239,6 +242,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the alpha component value of this <code>ColorRGBA</code>.
|
* Retrieves the alpha component value of this <code>ColorRGBA</code>.
|
||||||
|
*
|
||||||
* @return The alpha component value.
|
* @return The alpha component value.
|
||||||
*/
|
*/
|
||||||
public float getAlpha() {
|
public float getAlpha() {
|
||||||
@ -247,6 +251,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the red component value of this <code>ColorRGBA</code>.
|
* Retrieves the red component value of this <code>ColorRGBA</code>.
|
||||||
|
*
|
||||||
* @return The red component value.
|
* @return The red component value.
|
||||||
*/
|
*/
|
||||||
public float getRed() {
|
public float getRed() {
|
||||||
@ -255,6 +260,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the blue component value of this <code>ColorRGBA</code>.
|
* Retrieves the blue component value of this <code>ColorRGBA</code>.
|
||||||
|
*
|
||||||
* @return The blue component value.
|
* @return The blue component value.
|
||||||
*/
|
*/
|
||||||
public float getBlue() {
|
public float getBlue() {
|
||||||
@ -263,6 +269,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the green component value of this <code>ColorRGBA</code>.
|
* Retrieves the green component value of this <code>ColorRGBA</code>.
|
||||||
|
*
|
||||||
* @return The green component value.
|
* @return The green component value.
|
||||||
*/
|
*/
|
||||||
public float getGreen() {
|
public float getGreen() {
|
||||||
@ -273,6 +280,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Sets this <code>ColorRGBA</code> to the interpolation by changeAmnt from
|
* Sets this <code>ColorRGBA</code> to the interpolation by changeAmnt from
|
||||||
* this to the finalColor:
|
* this to the finalColor:
|
||||||
* this=(1-changeAmnt)*this + changeAmnt * finalColor
|
* this=(1-changeAmnt)*this + changeAmnt * finalColor
|
||||||
|
*
|
||||||
* @param finalColor The final color to interpolate towards.
|
* @param finalColor The final color to interpolate towards.
|
||||||
* @param changeAmnt An amount between 0.0 - 1.0 representing a percentage
|
* @param changeAmnt An amount between 0.0 - 1.0 representing a percentage
|
||||||
* change from this towards finalColor.
|
* change from this towards finalColor.
|
||||||
@ -290,6 +298,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Sets this <code>ColorRGBA</code> to the interpolation by changeAmnt from
|
* Sets this <code>ColorRGBA</code> to the interpolation by changeAmnt from
|
||||||
* beginColor to finalColor:
|
* beginColor to finalColor:
|
||||||
* this=(1-changeAmnt)*beginColor + changeAmnt * finalColor
|
* this=(1-changeAmnt)*beginColor + changeAmnt * finalColor
|
||||||
|
*
|
||||||
* @param beginColor The beginning color (changeAmnt=0).
|
* @param beginColor The beginning color (changeAmnt=0).
|
||||||
* @param finalColor The final color to interpolate towards (changeAmnt=1).
|
* @param finalColor The final color to interpolate towards (changeAmnt=1).
|
||||||
* @param changeAmnt An amount between 0.0 - 1.0 representing a percentage
|
* @param changeAmnt An amount between 0.0 - 1.0 representing a percentage
|
||||||
@ -307,6 +316,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* <code>randomColor</code> is a utility method that generates a random
|
* <code>randomColor</code> is a utility method that generates a random
|
||||||
* opaque color.
|
* opaque color.
|
||||||
|
*
|
||||||
* @return a random <code>ColorRGBA</code> with an alpha set to 1.
|
* @return a random <code>ColorRGBA</code> with an alpha set to 1.
|
||||||
*/
|
*/
|
||||||
public static ColorRGBA randomColor() {
|
public static ColorRGBA randomColor() {
|
||||||
@ -321,6 +331,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Multiplies each r,g,b,a of this <code>ColorRGBA</code> by the corresponding
|
* Multiplies each r,g,b,a of this <code>ColorRGBA</code> by the corresponding
|
||||||
* r,g,b,a of the given color and returns the result as a new <code>ColorRGBA</code>.
|
* r,g,b,a of the given color and returns the result as a new <code>ColorRGBA</code>.
|
||||||
* Used as a way of combining colors and lights.
|
* Used as a way of combining colors and lights.
|
||||||
|
*
|
||||||
* @param c The color to multiply by.
|
* @param c The color to multiply by.
|
||||||
* @return The new <code>ColorRGBA</code>. this*c
|
* @return The new <code>ColorRGBA</code>. this*c
|
||||||
*/
|
*/
|
||||||
@ -332,6 +343,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Multiplies each r,g,b,a of this <code>ColorRGBA</code> by the given scalar and
|
* Multiplies each r,g,b,a of this <code>ColorRGBA</code> by the given scalar and
|
||||||
* returns the result as a new <code>ColorRGBA</code>.
|
* returns the result as a new <code>ColorRGBA</code>.
|
||||||
* Used as a way of making colors dimmer or brighter.
|
* Used as a way of making colors dimmer or brighter.
|
||||||
|
*
|
||||||
* @param scalar The scalar to multiply by.
|
* @param scalar The scalar to multiply by.
|
||||||
* @return The new <code>ColorRGBA</code>. this*scalar
|
* @return The new <code>ColorRGBA</code>. this*scalar
|
||||||
*/
|
*/
|
||||||
@ -343,6 +355,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Multiplies each r,g,b,a of this <code>ColorRGBA</code> by the given scalar and
|
* Multiplies each r,g,b,a of this <code>ColorRGBA</code> by the given scalar and
|
||||||
* returns the result (this).
|
* returns the result (this).
|
||||||
* Used as a way of making colors dimmer or brighter.
|
* Used as a way of making colors dimmer or brighter.
|
||||||
|
*
|
||||||
* @param scalar The scalar to multiply by.
|
* @param scalar The scalar to multiply by.
|
||||||
* @return this*c
|
* @return this*c
|
||||||
*/
|
*/
|
||||||
@ -358,6 +371,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Adds each r,g,b,a of this <code>ColorRGBA</code> by the corresponding
|
* Adds each r,g,b,a of this <code>ColorRGBA</code> by the corresponding
|
||||||
* r,g,b,a of the given color and returns the result as a new <code>ColorRGBA</code>.
|
* r,g,b,a of the given color and returns the result as a new <code>ColorRGBA</code>.
|
||||||
* Used as a way of combining colors and lights.
|
* Used as a way of combining colors and lights.
|
||||||
|
*
|
||||||
* @param c The color to add.
|
* @param c The color to add.
|
||||||
* @return The new <code>ColorRGBA</code>. this+c
|
* @return The new <code>ColorRGBA</code>. this+c
|
||||||
*/
|
*/
|
||||||
@ -369,6 +383,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Adds each r,g,b,a of this <code>ColorRGBA</code> by the r,g,b,a the given
|
* Adds each r,g,b,a of this <code>ColorRGBA</code> by the r,g,b,a the given
|
||||||
* color and returns the result (this).
|
* color and returns the result (this).
|
||||||
* Used as a way of combining colors and lights.
|
* Used as a way of combining colors and lights.
|
||||||
|
*
|
||||||
* @param c The color to add.
|
* @param c The color to add.
|
||||||
* @return this+c
|
* @return this+c
|
||||||
*/
|
*/
|
||||||
@ -381,6 +396,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>toString</code> returns the string representation of this <code>ColorRGBA</code>.
|
* <code>toString</code> returns the string representation of this <code>ColorRGBA</code>.
|
||||||
* The format of the string is:<br>
|
* The format of the string is:<br>
|
||||||
* Color[R.RRRR, G.GGGG, B.BBBB, A.AAAA]
|
* Color[R.RRRR, G.GGGG, B.BBBB, A.AAAA]
|
||||||
|
*
|
||||||
* @return The string representation of this <code>ColorRGBA</code>.
|
* @return The string representation of this <code>ColorRGBA</code>.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -404,6 +420,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves this <code>ColorRGBA</code> into the given <code>float</code> array.
|
* Saves this <code>ColorRGBA</code> into the given <code>float</code> array.
|
||||||
|
*
|
||||||
* @param floats The <code>float</code> array to take this <code>ColorRGBA</code>.
|
* @param floats The <code>float</code> array to take this <code>ColorRGBA</code>.
|
||||||
* If null, a new <code>float[4]</code> is created.
|
* If null, a new <code>float[4]</code> is created.
|
||||||
* @return The array, with r,g,b,a float values in that order.
|
* @return The array, with r,g,b,a float values in that order.
|
||||||
@ -423,6 +440,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>equals</code> returns true if this <code>ColorRGBA</code> is logically equivalent
|
* <code>equals</code> returns true if this <code>ColorRGBA</code> is logically equivalent
|
||||||
* to a given color. That is, if all the components of the two colors are the same.
|
* to a given color. That is, if all the components of the two colors are the same.
|
||||||
* False is returned otherwise.
|
* False is returned otherwise.
|
||||||
|
*
|
||||||
* @param o The object to compare against.
|
* @param o The object to compare against.
|
||||||
* @return true if the colors are equal, false otherwise.
|
* @return true if the colors are equal, false otherwise.
|
||||||
*/
|
*/
|
||||||
@ -456,6 +474,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>hashCode</code> returns a unique code for this <code>ColorRGBA</code> based
|
* <code>hashCode</code> returns a unique code for this <code>ColorRGBA</code> based
|
||||||
* on its values. If two colors are logically equivalent, they will return
|
* on its values. If two colors are logically equivalent, they will return
|
||||||
* the same hash code value.
|
* the same hash code value.
|
||||||
|
*
|
||||||
* @return The hash code value of this <code>ColorRGBA</code>.
|
* @return The hash code value of this <code>ColorRGBA</code>.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -499,9 +518,11 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
b = capsule.readFloat("b", 0);
|
b = capsule.readFloat("b", 0);
|
||||||
a = capsule.readFloat("a", 0);
|
a = capsule.readFloat("a", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the component values of this <code>ColorRGBA</code> as
|
* Retrieves the component values of this <code>ColorRGBA</code> as
|
||||||
* a four element <code>byte</code> array in the order: r,g,b,a.
|
* a four element <code>byte</code> array in the order: r,g,b,a.
|
||||||
|
*
|
||||||
* @return the <code>byte</code> array that contains the color components.
|
* @return the <code>byte</code> array that contains the color components.
|
||||||
*/
|
*/
|
||||||
public byte[] asBytesRGBA() {
|
public byte[] asBytesRGBA() {
|
||||||
@ -517,6 +538,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Retrieves the component values of this <code>ColorRGBA</code> as an
|
* Retrieves the component values of this <code>ColorRGBA</code> as an
|
||||||
* <code>int</code> in a,r,g,b order.
|
* <code>int</code> in a,r,g,b order.
|
||||||
* Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue.
|
* Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue.
|
||||||
|
*
|
||||||
* @return The integer representation of this <code>ColorRGBA</code> in a,r,g,b order.
|
* @return The integer representation of this <code>ColorRGBA</code> in a,r,g,b order.
|
||||||
*/
|
*/
|
||||||
public int asIntARGB() {
|
public int asIntARGB() {
|
||||||
@ -531,6 +553,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Retrieves the component values of this <code>ColorRGBA</code> as an
|
* Retrieves the component values of this <code>ColorRGBA</code> as an
|
||||||
* <code>int</code> in r,g,b,a order.
|
* <code>int</code> in r,g,b,a order.
|
||||||
* Bits 24-31 are red, 16-23 are green, 8-15 are blue, 0-7 are alpha.
|
* Bits 24-31 are red, 16-23 are green, 8-15 are blue, 0-7 are alpha.
|
||||||
|
*
|
||||||
* @return The integer representation of this <code>ColorRGBA</code> in r,g,b,a order.
|
* @return The integer representation of this <code>ColorRGBA</code> in r,g,b,a order.
|
||||||
*/
|
*/
|
||||||
public int asIntRGBA() {
|
public int asIntRGBA() {
|
||||||
@ -540,10 +563,12 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
| (((int) (a * 255) & 0xFF));
|
| (((int) (a * 255) & 0xFF));
|
||||||
return rgba;
|
return rgba;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the component values of this <code>ColorRGBA</code> as an
|
* Retrieves the component values of this <code>ColorRGBA</code> as an
|
||||||
* <code>int</code> in a,b,g,r order.
|
* <code>int</code> in a,b,g,r order.
|
||||||
* Bits 24-31 are alpha, 16-23 are blue, 8-15 are green, 0-7 are red.
|
* Bits 24-31 are alpha, 16-23 are blue, 8-15 are green, 0-7 are red.
|
||||||
|
*
|
||||||
* @return The integer representation of this <code>ColorRGBA</code> in a,b,g,r order.
|
* @return The integer representation of this <code>ColorRGBA</code> in a,b,g,r order.
|
||||||
*/
|
*/
|
||||||
public int asIntABGR() {
|
public int asIntABGR() {
|
||||||
@ -553,10 +578,12 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
| (((int) (r * 255) & 0xFF));
|
| (((int) (r * 255) & 0xFF));
|
||||||
return abgr;
|
return abgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the component values of this <code>ColorRGBA</code> with the given
|
* Sets the component values of this <code>ColorRGBA</code> with the given
|
||||||
* combined ARGB <code>int</code>.
|
* combined ARGB <code>int</code>.
|
||||||
* Bits 24-31 are alpha, bits 16-23 are red, bits 8-15 are green, bits 0-7 are blue.
|
* Bits 24-31 are alpha, bits 16-23 are red, bits 8-15 are green, bits 0-7 are blue.
|
||||||
|
*
|
||||||
* @param color The integer ARGB value used to set this <code>ColorRGBA</code>.
|
* @param color The integer ARGB value used to set this <code>ColorRGBA</code>.
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
@ -567,9 +594,11 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
b = ((byte) (color) & 0xFF) / 255f;
|
b = ((byte) (color) & 0xFF) / 255f;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the RGBA values of this <code>ColorRGBA</code> with the given combined RGBA value
|
* Sets the RGBA values of this <code>ColorRGBA</code> with the given combined RGBA value
|
||||||
* Bits 24-31 are red, bits 16-23 are green, bits 8-15 are blue, bits 0-7 are alpha.
|
* Bits 24-31 are red, bits 16-23 are green, bits 8-15 are blue, bits 0-7 are alpha.
|
||||||
|
*
|
||||||
* @param color The integer RGBA value used to set this object.
|
* @param color The integer RGBA value used to set this object.
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
@ -580,9 +609,11 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
a = ((byte) (color) & 0xFF) / 255f;
|
a = ((byte) (color) & 0xFF) / 255f;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the RGBA values of this <code>ColorRGBA</code> with the given combined ABGR value
|
* Sets the RGBA values of this <code>ColorRGBA</code> with the given combined ABGR value
|
||||||
* Bits 24-31 are alpha, bits 16-23 are blue, bits 8-15 are green, bits 0-7 are red.
|
* Bits 24-31 are alpha, bits 16-23 are blue, bits 8-15 are green, bits 0-7 are red.
|
||||||
|
*
|
||||||
* @param color The integer ABGR value used to set this object.
|
* @param color The integer ABGR value used to set this object.
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
@ -598,6 +629,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Transform this <code>ColorRGBA</code> to a <code>Vector3f</code> using
|
* Transform this <code>ColorRGBA</code> to a <code>Vector3f</code> using
|
||||||
* x = r, y = g, z = b. The Alpha value is not used.
|
* x = r, y = g, z = b. The Alpha value is not used.
|
||||||
* This method is useful for shader assignments.
|
* This method is useful for shader assignments.
|
||||||
|
*
|
||||||
* @return A <code>Vector3f</code> containing the RGB value of this <code>ColorRGBA</code>.
|
* @return A <code>Vector3f</code> containing the RGB value of this <code>ColorRGBA</code>.
|
||||||
*/
|
*/
|
||||||
public Vector3f toVector3f() {
|
public Vector3f toVector3f() {
|
||||||
@ -608,6 +640,7 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Transform this <code>ColorRGBA</code> to a <code>Vector4f</code> using
|
* Transform this <code>ColorRGBA</code> to a <code>Vector4f</code> using
|
||||||
* x = r, y = g, z = b, w = a.
|
* x = r, y = g, z = b, w = a.
|
||||||
* This method is useful for shader assignments.
|
* This method is useful for shader assignments.
|
||||||
|
*
|
||||||
* @return A <code>Vector4f</code> containing the RGBA value of this <code>ColorRGBA</code>.
|
* @return A <code>Vector4f</code> containing the RGBA value of this <code>ColorRGBA</code>.
|
||||||
*/
|
*/
|
||||||
public Vector4f toVector4f() {
|
public Vector4f toVector4f() {
|
||||||
@ -632,10 +665,10 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
*
|
*
|
||||||
* @return this ColorRGBA with updated values.
|
* @return this ColorRGBA with updated values.
|
||||||
*/
|
*/
|
||||||
public ColorRGBA setAsSrgb(float r, float g, float b, float a){
|
public ColorRGBA setAsSrgb(float r, float g, float b, float a) {
|
||||||
this.r = (float)Math.pow(r, GAMMA);
|
this.r = (float) Math.pow(r, GAMMA);
|
||||||
this.b = (float)Math.pow(b, GAMMA);
|
this.b = (float) Math.pow(b, GAMMA);
|
||||||
this.g = (float)Math.pow(g, GAMMA);
|
this.g = (float) Math.pow(g, GAMMA);
|
||||||
this.a = a;
|
this.a = a;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -666,5 +699,4 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable
|
|||||||
srgb.a = a;
|
srgb.a = a;
|
||||||
return srgb;
|
return srgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ package com.jme3.math;
|
|||||||
* Created by Nehon on 26/03/2017.
|
* Created by Nehon on 26/03/2017.
|
||||||
*/
|
*/
|
||||||
public interface EaseFunction {
|
public interface EaseFunction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param value a value from 0 to 1. Passing a value out of this range will have unexpected behavior.
|
* @param value a value from 0 to 1. Passing a value out of this range will have unexpected behavior.
|
||||||
* @return the blended value
|
* @return the blended value
|
||||||
|
@ -5,8 +5,6 @@ package com.jme3.math;
|
|||||||
* Created by Nehon on 26/03/2017.
|
* Created by Nehon on 26/03/2017.
|
||||||
*/
|
*/
|
||||||
public class Easing {
|
public class Easing {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a function that always returns 0
|
* a function that always returns 0
|
||||||
*/
|
*/
|
||||||
@ -66,7 +64,6 @@ public class Easing {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Out Elastic and bounce
|
* Out Elastic and bounce
|
||||||
*/
|
*/
|
||||||
@ -122,11 +119,9 @@ public class Easing {
|
|||||||
public static EaseFunction inOutElastic = new InOut(inElastic, outElastic);
|
public static EaseFunction inOutElastic = new InOut(inElastic, outElastic);
|
||||||
public static EaseFunction inOutBounce = new InOut(inBounce, outBounce);
|
public static EaseFunction inOutBounce = new InOut(inBounce, outBounce);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extra functions
|
* Extra functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static EaseFunction smoothStep = new EaseFunction() {
|
public static EaseFunction smoothStep = new EaseFunction() {
|
||||||
@Override
|
@Override
|
||||||
public float apply(float t) {
|
public float apply(float t) {
|
||||||
@ -185,6 +180,4 @@ public class Easing {
|
|||||||
return 1f - func.apply(1f - value);
|
return 1f - func.apply(1f - value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ import java.util.logging.Logger;
|
|||||||
* A calculator for the eigenvectors and eigenvalues of a Matrix3f.
|
* A calculator for the eigenvectors and eigenvalues of a Matrix3f.
|
||||||
*/
|
*/
|
||||||
public class Eigen3f implements java.io.Serializable {
|
public class Eigen3f implements java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(Eigen3f.class
|
private static final Logger logger = Logger.getLogger(Eigen3f.class
|
||||||
@ -50,7 +49,6 @@ public class Eigen3f implements java.io.Serializable {
|
|||||||
static final double ONE_THIRD_DOUBLE = 1.0 / 3.0;
|
static final double ONE_THIRD_DOUBLE = 1.0 / 3.0;
|
||||||
static final double ROOT_THREE_DOUBLE = Math.sqrt(3.0);
|
static final double ROOT_THREE_DOUBLE = Math.sqrt(3.0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate an empty calculator.
|
* Instantiate an empty calculator.
|
||||||
*/
|
*/
|
||||||
@ -193,6 +191,7 @@ public class Eigen3f implements java.io.Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the eigenvectors of the given Matrix, using the
|
* Compute the eigenvectors of the given Matrix, using the
|
||||||
|
*
|
||||||
* @param mat
|
* @param mat
|
||||||
* @param vect
|
* @param vect
|
||||||
* @param index1
|
* @param index1
|
||||||
@ -404,8 +403,9 @@ public class Eigen3f implements java.io.Serializable {
|
|||||||
Eigen3f eigenSystem = new Eigen3f(mat);
|
Eigen3f eigenSystem = new Eigen3f(mat);
|
||||||
|
|
||||||
logger.info("eigenvalues = ");
|
logger.info("eigenvalues = ");
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++) {
|
||||||
logger.log(Level.FINE, "{0} ", eigenSystem.getEigenValue(i));
|
logger.log(Level.FINE, "{0} ", eigenSystem.getEigenValue(i));
|
||||||
|
}
|
||||||
|
|
||||||
logger.info("eigenvectors = ");
|
logger.info("eigenvectors = ");
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
@ -267,6 +267,7 @@ final public class FastMath {
|
|||||||
* [-T 2-T T-2 T ]
|
* [-T 2-T T-2 T ]
|
||||||
* where T is the curve tension
|
* where T is the curve tension
|
||||||
* the result is a value between p1 and p2, t=0 for p1, t=1 for p2
|
* the result is a value between p1 and p2, t=0 for p1, t=1 for p2
|
||||||
|
*
|
||||||
* @param u value from 0 to 1
|
* @param u value from 0 to 1
|
||||||
* @param T The tension of the curve
|
* @param T The tension of the curve
|
||||||
* @param p0 control point 0
|
* @param p0 control point 0
|
||||||
@ -294,6 +295,7 @@ final public class FastMath {
|
|||||||
* [-T 2-T T-2 T ]
|
* [-T 2-T T-2 T ]
|
||||||
* where T is the tension of the curve
|
* where T is the tension of the curve
|
||||||
* the result is a value between p1 and p2, t=0 for p1, t=1 for p2
|
* the result is a value between p1 and p2, t=0 for p1, t=1 for p2
|
||||||
|
*
|
||||||
* @param u value from 0 to 1
|
* @param u value from 0 to 1
|
||||||
* @param T The tension of the curve
|
* @param T The tension of the curve
|
||||||
* @param p0 control point 0
|
* @param p0 control point 0
|
||||||
@ -323,6 +325,7 @@ final public class FastMath {
|
|||||||
* [-T 2-T T-2 T ]
|
* [-T 2-T T-2 T ]
|
||||||
* where T is the tension of the curve
|
* where T is the tension of the curve
|
||||||
* the result is a value between p1 and p2, t=0 for p1, t=1 for p2
|
* the result is a value between p1 and p2, t=0 for p1, t=1 for p2
|
||||||
|
*
|
||||||
* @param u value from 0 to 1
|
* @param u value from 0 to 1
|
||||||
* @param T The tension of the curve
|
* @param T The tension of the curve
|
||||||
* @param p0 control point 0
|
* @param p0 control point 0
|
||||||
@ -344,6 +347,7 @@ final public class FastMath {
|
|||||||
* [ 1.0 0.0 0.0 0.0 ]
|
* [ 1.0 0.0 0.0 0.0 ]
|
||||||
* where T is the curve tension
|
* where T is the curve tension
|
||||||
* the result is a value between p1 and p3, t=0 for p1, t=1 for p3
|
* the result is a value between p1 and p3, t=0 for p1, t=1 for p3
|
||||||
|
*
|
||||||
* @param u value from 0 to 1
|
* @param u value from 0 to 1
|
||||||
* @param p0 control point 0
|
* @param p0 control point 0
|
||||||
* @param p1 control point 1
|
* @param p1 control point 1
|
||||||
@ -370,6 +374,7 @@ final public class FastMath {
|
|||||||
* [ 1.0 0.0 0.0 0.0 ]
|
* [ 1.0 0.0 0.0 0.0 ]
|
||||||
* where T is the tension of the curve
|
* where T is the tension of the curve
|
||||||
* the result is a value between p1 and p3, t=0 for p1, t=1 for p3
|
* the result is a value between p1 and p3, t=0 for p1, t=1 for p3
|
||||||
|
*
|
||||||
* @param u value from 0 to 1
|
* @param u value from 0 to 1
|
||||||
* @param p0 control point 0
|
* @param p0 control point 0
|
||||||
* @param p1 control point 1
|
* @param p1 control point 1
|
||||||
@ -398,6 +403,7 @@ final public class FastMath {
|
|||||||
* [ 1.0 0.0 0.0 0.0 ]
|
* [ 1.0 0.0 0.0 0.0 ]
|
||||||
* where T is the tension of the curve
|
* where T is the tension of the curve
|
||||||
* the result is a value between p1 and p3, t=0 for p1, t=1 for p3
|
* the result is a value between p1 and p3, t=0 for p1, t=1 for p3
|
||||||
|
*
|
||||||
* @param u value from 0 to 1
|
* @param u value from 0 to 1
|
||||||
* @param p0 control point 0
|
* @param p0 control point 0
|
||||||
* @param p1 control point 1
|
* @param p1 control point 1
|
||||||
@ -1001,10 +1007,8 @@ final public class FastMath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param x
|
* @param x the value whose sign is to be adjusted.
|
||||||
* the value whose sign is to be adjusted.
|
* @param y the value whose sign is to be used.
|
||||||
* @param y
|
|
||||||
* the value whose sign is to be used.
|
|
||||||
* @return x with its sign changed to match the sign of y.
|
* @return x with its sign changed to match the sign of y.
|
||||||
*/
|
*/
|
||||||
public static float copysign(float x, float y) {
|
public static float copysign(float x, float y) {
|
||||||
|
@ -45,7 +45,6 @@ import java.nio.FloatBuffer;
|
|||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
public class Line implements Savable, Cloneable, java.io.Serializable {
|
public class Line implements Savable, Cloneable, java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private Vector3f origin;
|
private Vector3f origin;
|
||||||
@ -64,6 +63,7 @@ public class Line implements Savable, Cloneable, java.io.Serializable {
|
|||||||
/**
|
/**
|
||||||
* Constructor instantiates a new <code>Line</code> object. The origin
|
* Constructor instantiates a new <code>Line</code> object. The origin
|
||||||
* and direction are set via the parameters.
|
* and direction are set via the parameters.
|
||||||
|
*
|
||||||
* @param origin the origin of the line.
|
* @param origin the origin of the line.
|
||||||
* @param direction the direction of the line.
|
* @param direction the direction of the line.
|
||||||
*/
|
*/
|
||||||
@ -73,8 +73,8 @@ public class Line implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>getOrigin</code> returns the origin of the line.
|
* <code>getOrigin</code> returns the origin of the line.
|
||||||
|
*
|
||||||
* @return the origin of the line.
|
* @return the origin of the line.
|
||||||
*/
|
*/
|
||||||
public Vector3f getOrigin() {
|
public Vector3f getOrigin() {
|
||||||
@ -82,8 +82,8 @@ public class Line implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>setOrigin</code> sets the origin of the line.
|
* <code>setOrigin</code> sets the origin of the line.
|
||||||
|
*
|
||||||
* @param origin the origin of the line.
|
* @param origin the origin of the line.
|
||||||
*/
|
*/
|
||||||
public void setOrigin(Vector3f origin) {
|
public void setOrigin(Vector3f origin) {
|
||||||
@ -91,8 +91,8 @@ public class Line implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>getDirection</code> returns the direction of the line.
|
* <code>getDirection</code> returns the direction of the line.
|
||||||
|
*
|
||||||
* @return the direction of the line.
|
* @return the direction of the line.
|
||||||
*/
|
*/
|
||||||
public Vector3f getDirection() {
|
public Vector3f getDirection() {
|
||||||
@ -100,8 +100,8 @@ public class Line implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>setDirection</code> sets the direction of the line.
|
* <code>setDirection</code> sets the direction of the line.
|
||||||
|
*
|
||||||
* @param direction the direction of the line.
|
* @param direction the direction of the line.
|
||||||
*/
|
*/
|
||||||
public void setDirection(Vector3f direction) {
|
public void setDirection(Vector3f direction) {
|
||||||
@ -203,8 +203,8 @@ public class Line implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>random</code> determines a random point along the line.
|
* <code>random</code> determines a random point along the line.
|
||||||
|
*
|
||||||
* @return a random point on the line.
|
* @return a random point on the line.
|
||||||
*/
|
*/
|
||||||
public Vector3f random() {
|
public Vector3f random() {
|
||||||
|
@ -50,7 +50,6 @@ import java.io.IOException;
|
|||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
public class LineSegment implements Cloneable, Savable, java.io.Serializable {
|
public class LineSegment implements Cloneable, Savable, java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private Vector3f origin;
|
private Vector3f origin;
|
||||||
@ -742,7 +741,6 @@ public class LineSegment implements Cloneable, Savable, java.io.Serializable {
|
|||||||
* @return true if contained in the box, otherwise false
|
* @return true if contained in the box, otherwise false
|
||||||
*/
|
*/
|
||||||
public boolean isPointInsideBounds(Vector3f point, float error) {
|
public boolean isPointInsideBounds(Vector3f point, float error) {
|
||||||
|
|
||||||
if (FastMath.abs(point.x - origin.x) > FastMath.abs(direction.x * extent) + error) {
|
if (FastMath.abs(point.x - origin.x) > FastMath.abs(direction.x * extent) + error) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import com.jme3.util.TempVars;
|
|||||||
* Created by Nehon on 23/04/2017.
|
* Created by Nehon on 23/04/2017.
|
||||||
*/
|
*/
|
||||||
public class MathUtils {
|
public class MathUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the natural logarithm of a unit quaternion.
|
* Calculate the natural logarithm of a unit quaternion.
|
||||||
*
|
*
|
||||||
@ -157,7 +156,6 @@ public class MathUtils {
|
|||||||
private static Quaternion spline(Quaternion qnm1, Quaternion qn, Quaternion qnp1, Quaternion store, Quaternion tmp) {
|
private static Quaternion spline(Quaternion qnm1, Quaternion qn, Quaternion qnp1, Quaternion store, Quaternion tmp) {
|
||||||
Quaternion invQn = new Quaternion(-qn.x, -qn.y, -qn.z, qn.w);
|
Quaternion invQn = new Quaternion(-qn.x, -qn.y, -qn.z, qn.w);
|
||||||
|
|
||||||
|
|
||||||
log(invQn.mult(qnp1), tmp);
|
log(invQn.mult(qnp1), tmp);
|
||||||
log(invQn.mult(qnm1), store);
|
log(invQn.mult(qnm1), store);
|
||||||
store.addLocal(tmp).multLocal(-1f / 4f);
|
store.addLocal(tmp).multLocal(-1f / 4f);
|
||||||
@ -168,7 +166,6 @@ public class MathUtils {
|
|||||||
//return qn * (((qni * qnm1).log() + (qni * qnp1).log()) / -4).exp();
|
//return qn * (((qni * qnm1).log() + (qni * qnp1).log()) / -4).exp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! spherical cubic interpolation
|
//! spherical cubic interpolation
|
||||||
public static Quaternion squad(Quaternion q0, Quaternion q1, Quaternion q2, Quaternion q3, Quaternion a, Quaternion b, float t, Quaternion store) {
|
public static Quaternion squad(Quaternion q0, Quaternion q1, Quaternion q2, Quaternion q3, Quaternion a, Quaternion b, float t, Quaternion store) {
|
||||||
|
|
||||||
@ -187,7 +184,6 @@ public class MathUtils {
|
|||||||
// return slerpNoInvert(c, d, 2 * t * (1 - t));
|
// return slerpNoInvert(c, d, 2 * t * (1 - t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the shortest distance between a Ray and a segment.
|
* Returns the shortest distance between a Ray and a segment.
|
||||||
* The segment is defined by a start position and an end position in world space
|
* The segment is defined by a start position and an end position in world space
|
||||||
@ -266,5 +262,4 @@ public class MathUtils {
|
|||||||
vars.release();
|
vars.release();
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,6 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
*/
|
*/
|
||||||
public Matrix3f(float m00, float m01, float m02, float m10, float m11,
|
public Matrix3f(float m00, float m01, float m02, float m10, float m11,
|
||||||
float m12, float m20, float m21, float m22) {
|
float m12, float m20, float m21, float m22) {
|
||||||
|
|
||||||
this.m00 = m00;
|
this.m00 = m00;
|
||||||
this.m01 = m01;
|
this.m01 = m01;
|
||||||
this.m02 = m02;
|
this.m02 = m02;
|
||||||
@ -340,8 +339,7 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>getColumn</code> returns one of three columns specified by the
|
* <code>getColumn</code> returns one of three columns specified by the
|
||||||
* parameter. This column is returned as a <code>Vector3f</code> object.
|
* parameter. This column is returned as a <code>Vector3f</code> object.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the column to retrieve. Must be between 0 and 2.
|
||||||
* the column to retrieve. Must be between 0 and 2.
|
|
||||||
* @return the column specified by the index.
|
* @return the column specified by the index.
|
||||||
*/
|
*/
|
||||||
public Vector3f getColumn(int i) {
|
public Vector3f getColumn(int i) {
|
||||||
@ -352,8 +350,7 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>getColumn</code> returns one of three columns specified by the
|
* <code>getColumn</code> returns one of three columns specified by the
|
||||||
* parameter. This column is returned as a <code>Vector3f</code> object.
|
* parameter. This column is returned as a <code>Vector3f</code> object.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the column to retrieve. Must be between 0 and 2.
|
||||||
* the column to retrieve. Must be between 0 and 2.
|
|
||||||
* @param store
|
* @param store
|
||||||
* the vector object to store the result in. if null, a new one
|
* the vector object to store the result in. if null, a new one
|
||||||
* is created.
|
* is created.
|
||||||
@ -390,8 +387,7 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>getColumn</code> returns one of three rows as specified by the
|
* <code>getColumn</code> returns one of three rows as specified by the
|
||||||
* parameter. This row is returned as a <code>Vector3f</code> object.
|
* parameter. This row is returned as a <code>Vector3f</code> object.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the row to retrieve. Must be between 0 and 2.
|
||||||
* the row to retrieve. Must be between 0 and 2.
|
|
||||||
* @return the row specified by the index.
|
* @return the row specified by the index.
|
||||||
*/
|
*/
|
||||||
public Vector3f getRow(int i) {
|
public Vector3f getRow(int i) {
|
||||||
@ -402,8 +398,7 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>getRow</code> returns one of three rows as specified by the
|
* <code>getRow</code> returns one of three rows as specified by the
|
||||||
* parameter. This row is returned as a <code>Vector3f</code> object.
|
* parameter. This row is returned as a <code>Vector3f</code> object.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the row to retrieve. Must be between 0 and 2.
|
||||||
* the row to retrieve. Must be between 0 and 2.
|
|
||||||
* @param store
|
* @param store
|
||||||
* the vector object to store the result in. if null, a new one
|
* the vector object to store the result in. if null, a new one
|
||||||
* is created.
|
* is created.
|
||||||
@ -520,14 +515,12 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>setColumn</code> sets a particular column of this matrix to that
|
* <code>setColumn</code> sets a particular column of this matrix to that
|
||||||
* represented by the provided vector.
|
* represented by the provided vector.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the column to set.
|
||||||
* the column to set.
|
|
||||||
* @param column
|
* @param column
|
||||||
* the data to set.
|
* the data to set.
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Matrix3f setColumn(int i, Vector3f column) {
|
public Matrix3f setColumn(int i, Vector3f column) {
|
||||||
|
|
||||||
if (column == null) {
|
if (column == null) {
|
||||||
logger.warning("Column is null. Ignoring.");
|
logger.warning("Column is null. Ignoring.");
|
||||||
return this;
|
return this;
|
||||||
@ -559,14 +552,12 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>setRow</code> sets a particular row of this matrix to that
|
* <code>setRow</code> sets a particular row of this matrix to that
|
||||||
* represented by the provided vector.
|
* represented by the provided vector.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the row to set.
|
||||||
* the row to set.
|
|
||||||
* @param row
|
* @param row
|
||||||
* the data to set.
|
* the data to set.
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Matrix3f setRow(int i, Vector3f row) {
|
public Matrix3f setRow(int i, Vector3f row) {
|
||||||
|
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
logger.warning("Row is null. Ignoring.");
|
logger.warning("Row is null. Ignoring.");
|
||||||
return this;
|
return this;
|
||||||
@ -598,10 +589,8 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>set</code> places a given value into the matrix at the given
|
* <code>set</code> places a given value into the matrix at the given
|
||||||
* position.
|
* position.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the row index.
|
||||||
* the row index.
|
* @param j the column index.
|
||||||
* @param j
|
|
||||||
* the column index.
|
|
||||||
* @param value
|
* @param value
|
||||||
* the value for (i, j).
|
* the value for (i, j).
|
||||||
* @return this
|
* @return this
|
||||||
@ -858,7 +847,6 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* @return a matrix3f object containing the result of this operation
|
* @return a matrix3f object containing the result of this operation
|
||||||
*/
|
*/
|
||||||
public Matrix3f mult(Matrix3f mat, Matrix3f product) {
|
public Matrix3f mult(Matrix3f mat, Matrix3f product) {
|
||||||
|
|
||||||
float temp00, temp01, temp02;
|
float temp00, temp01, temp02;
|
||||||
float temp10, temp11, temp12;
|
float temp10, temp11, temp12;
|
||||||
float temp20, temp21, temp22;
|
float temp20, temp21, temp22;
|
||||||
@ -914,7 +902,6 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* @return The given product vector.
|
* @return The given product vector.
|
||||||
*/
|
*/
|
||||||
public Vector3f mult(Vector3f vec, Vector3f product) {
|
public Vector3f mult(Vector3f vec, Vector3f product) {
|
||||||
|
|
||||||
if (null == product) {
|
if (null == product) {
|
||||||
product = new Vector3f();
|
product = new Vector3f();
|
||||||
}
|
}
|
||||||
@ -1230,8 +1217,7 @@ public final class Matrix3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* are these two matrices the same? they are is they both have the same mXX values.
|
* are these two matrices the same? they are is they both have the same mXX values.
|
||||||
*
|
*
|
||||||
* @param o
|
* @param o the object to compare for equality
|
||||||
* the object to compare for equality
|
|
||||||
* @return true if they are equal
|
* @return true if they are equal
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,7 +55,6 @@ import java.util.logging.Logger;
|
|||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
public final class Matrix4f implements Savable, Cloneable, java.io.Serializable {
|
public final class Matrix4f implements Savable, Cloneable, java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(Matrix4f.class.getName());
|
private static final Logger logger = Logger.getLogger(Matrix4f.class.getName());
|
||||||
@ -1940,12 +1939,9 @@ public final class Matrix4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* Sets the scale.
|
* Sets the scale.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x the X scale
|
||||||
* the X scale
|
* @param y the Y scale
|
||||||
* @param y
|
* @param z the Z scale
|
||||||
* the Y scale
|
|
||||||
* @param z
|
|
||||||
* the Z scale
|
|
||||||
*/
|
*/
|
||||||
public void setScale(float x, float y, float z) {
|
public void setScale(float x, float y, float z) {
|
||||||
|
|
||||||
@ -2324,8 +2320,7 @@ public final class Matrix4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* are these two matrices the same? they are is they both have the same mXX values.
|
* are these two matrices the same? they are is they both have the same mXX values.
|
||||||
*
|
*
|
||||||
* @param o
|
* @param o the object to compare for equality
|
||||||
* the object to compare for equality
|
|
||||||
* @return true if they are equal
|
* @return true if they are equal
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -309,8 +309,8 @@ public class Plane implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* De-serialize this plane from the specified importer, for example
|
* De-serialize this plane from the specified importer, for example when
|
||||||
* when loading from a J3O file.
|
* loading from a J3O file.
|
||||||
*
|
*
|
||||||
* @param e (not null)
|
* @param e (not null)
|
||||||
* @throws IOException from the importer
|
* @throws IOException from the importer
|
||||||
|
@ -602,8 +602,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
|||||||
* by the parameter. This column is returned as a <code>Vector3f</code>
|
* by the parameter. This column is returned as a <code>Vector3f</code>
|
||||||
* object.
|
* object.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the column to retrieve. Must be between 0 and 2.
|
||||||
* the column to retrieve. Must be between 0 and 2.
|
|
||||||
* @return the column specified by the index.
|
* @return the column specified by the index.
|
||||||
*/
|
*/
|
||||||
public Vector3f getRotationColumn(int i) {
|
public Vector3f getRotationColumn(int i) {
|
||||||
@ -615,8 +614,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
|||||||
* by the parameter. This column is returned as a <code>Vector3f</code>
|
* by the parameter. This column is returned as a <code>Vector3f</code>
|
||||||
* object. The value is retrieved as if this quaternion was first normalized.
|
* object. The value is retrieved as if this quaternion was first normalized.
|
||||||
*
|
*
|
||||||
* @param i
|
* @param i the column to retrieve. Must be between 0 and 2.
|
||||||
* the column to retrieve. Must be between 0 and 2.
|
|
||||||
* @param store
|
* @param store
|
||||||
* the vector object to store the result in. if null, a new one
|
* the vector object to store the result in. if null, a new one
|
||||||
* is created.
|
* is created.
|
||||||
@ -748,8 +746,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
|||||||
* the first quaternion.
|
* the first quaternion.
|
||||||
* @param q2
|
* @param q2
|
||||||
* the second quaternion.
|
* the second quaternion.
|
||||||
* @param t
|
* @param t the amount to interpolate between the two quaternions.
|
||||||
* the amount to interpolate between the two quaternions.
|
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Quaternion slerp(Quaternion q1, Quaternion q2, float t) {
|
public Quaternion slerp(Quaternion q1, Quaternion q2, float t) {
|
||||||
@ -935,8 +932,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
|||||||
* The result is returned as a new quaternion. It should be noted that
|
* The result is returned as a new quaternion. It should be noted that
|
||||||
* quaternion multiplication is not commutative so q * p != p * q.
|
* quaternion multiplication is not commutative so q * p != p * q.
|
||||||
*
|
*
|
||||||
* @param q
|
* @param q the quaternion to multiply this quaternion by.
|
||||||
* the quaternion to multiply this quaternion by.
|
|
||||||
* @return the new quaternion.
|
* @return the new quaternion.
|
||||||
*/
|
*/
|
||||||
public Quaternion mult(Quaternion q) {
|
public Quaternion mult(Quaternion q) {
|
||||||
@ -1178,8 +1174,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
|||||||
* <code>dot</code> calculates and returns the dot product of this
|
* <code>dot</code> calculates and returns the dot product of this
|
||||||
* quaternion with that of the parameter quaternion.
|
* quaternion with that of the parameter quaternion.
|
||||||
*
|
*
|
||||||
* @param q
|
* @param q the quaternion to calculate the dot product of.
|
||||||
* the quaternion to calculate the dot product of.
|
|
||||||
* @return the dot product of this and the parameter quaternion.
|
* @return the dot product of this and the parameter quaternion.
|
||||||
*/
|
*/
|
||||||
public float dot(Quaternion q) {
|
public float dot(Quaternion q) {
|
||||||
@ -1292,8 +1287,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
|||||||
* <code>equals</code> determines if two quaternions are logically equal,
|
* <code>equals</code> determines if two quaternions are logically equal,
|
||||||
* that is, if the values of (x, y, z, w) are the same for both quaternions.
|
* that is, if the values of (x, y, z, w) are the same for both quaternions.
|
||||||
*
|
*
|
||||||
* @param o
|
* @param o the object to compare for equality
|
||||||
* the object to compare for equality
|
|
||||||
* @return true if they are equal, false otherwise.
|
* @return true if they are equal, false otherwise.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -1469,6 +1463,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: This seems to have singularity type issues with angle == 0, possibly others such as PI.
|
* FIXME: This seems to have singularity type issues with angle == 0, possibly others such as PI.
|
||||||
|
*
|
||||||
* @param store
|
* @param store
|
||||||
* A Quaternion to store our result in. If null, a new one is
|
* A Quaternion to store our result in. If null, a new one is
|
||||||
* created.
|
* created.
|
||||||
|
@ -46,23 +46,20 @@ import java.io.IOException;
|
|||||||
* defined by the following equation: {@literal
|
* defined by the following equation: {@literal
|
||||||
* R(t) = origin + t*direction for t >= 0.
|
* R(t) = origin + t*direction for t >= 0.
|
||||||
* }
|
* }
|
||||||
|
*
|
||||||
* @author Mark Powell
|
* @author Mark Powell
|
||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
public final class Ray implements Savable, Cloneable, Collidable, java.io.Serializable {
|
public final class Ray implements Savable, Cloneable, Collidable, java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ray's beginning point.
|
* The ray's beginning point.
|
||||||
*/
|
*/
|
||||||
public Vector3f origin = new Vector3f();
|
public Vector3f origin = new Vector3f();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The direction of the ray.
|
* The direction of the ray.
|
||||||
*/
|
*/
|
||||||
public Vector3f direction = new Vector3f(0, 0, 1);
|
public Vector3f direction = new Vector3f(0, 0, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The length of the ray (defaults to +Infinity).
|
* The length of the ray (defaults to +Infinity).
|
||||||
*/
|
*/
|
||||||
@ -79,6 +76,7 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
/**
|
/**
|
||||||
* Constructor instantiates a new <code>Ray</code> object. The origin and
|
* Constructor instantiates a new <code>Ray</code> object. The origin and
|
||||||
* direction are given.
|
* direction are given.
|
||||||
|
*
|
||||||
* @param origin the origin of the ray.
|
* @param origin the origin of the ray.
|
||||||
* @param direction the direction the ray travels in.
|
* @param direction the direction the ray travels in.
|
||||||
*/
|
*/
|
||||||
@ -87,15 +85,17 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
setDirection(direction);
|
setDirection(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* <code>intersect</code> determines if the Ray intersects a triangle.
|
* <code>intersect</code> determines if the Ray intersects a triangle.
|
||||||
|
*
|
||||||
* @param t the Triangle to test against.
|
* @param t the Triangle to test against.
|
||||||
* @return true if the ray collides.
|
* @return true if the ray collides.
|
||||||
*/
|
*/
|
||||||
// public boolean intersect(Triangle t) {
|
// public boolean intersect(Triangle t) {
|
||||||
// return intersect(t.get(0), t.get(1), t.get(2));
|
// return intersect(t.get(0), t.get(1), t.get(2));
|
||||||
// }
|
// }
|
||||||
/**
|
|
||||||
|
/*
|
||||||
* <code>intersect</code> determines if the Ray intersects a triangle
|
* <code>intersect</code> determines if the Ray intersects a triangle
|
||||||
* defined by the specified points.
|
* defined by the specified points.
|
||||||
*
|
*
|
||||||
@ -110,12 +110,13 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
// public boolean intersect(Vector3f v0,Vector3f v1,Vector3f v2){
|
// public boolean intersect(Vector3f v0,Vector3f v1,Vector3f v2){
|
||||||
// return intersectWhere(v0, v1, v2, null);
|
// return intersectWhere(v0, v1, v2, null);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>intersectWhere</code> determines if the Ray intersects a triangle. It then
|
* <code>intersectWhere</code> determines if the Ray intersects a triangle.
|
||||||
* stores the point of intersection in the given loc vector
|
* It then stores the point of intersection in the given loc vector
|
||||||
|
*
|
||||||
* @param t the Triangle to test against.
|
* @param t the Triangle to test against.
|
||||||
* @param loc
|
* @param loc storage vector to save the collision point in (if the ray
|
||||||
* storage vector to save the collision point in (if the ray
|
|
||||||
* collides)
|
* collides)
|
||||||
* @return true if the ray collides.
|
* @return true if the ray collides.
|
||||||
*/
|
*/
|
||||||
@ -363,7 +364,6 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param p
|
* @param p
|
||||||
* @param loc
|
* @param loc
|
||||||
* @return true if the ray collides with the given Plane
|
* @return true if the ray collides with the given Plane
|
||||||
@ -437,8 +437,8 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>setOrigin</code> sets the origin of the ray.
|
* <code>setOrigin</code> sets the origin of the ray.
|
||||||
|
*
|
||||||
* @param origin the origin of the ray.
|
* @param origin the origin of the ray.
|
||||||
*/
|
*/
|
||||||
public void setOrigin(Vector3f origin) {
|
public void setOrigin(Vector3f origin) {
|
||||||
@ -458,6 +458,7 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>setLimit</code> sets the limit of the ray.
|
* <code>setLimit</code> sets the limit of the ray.
|
||||||
|
*
|
||||||
* @param limit the limit of the ray.
|
* @param limit the limit of the ray.
|
||||||
* @see Ray#getLimit()
|
* @see Ray#getLimit()
|
||||||
*/
|
*/
|
||||||
@ -466,8 +467,8 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>getDirection</code> retrieves the direction vector of the ray.
|
* <code>getDirection</code> retrieves the direction vector of the ray.
|
||||||
|
*
|
||||||
* @return the direction of the ray.
|
* @return the direction of the ray.
|
||||||
*/
|
*/
|
||||||
public Vector3f getDirection() {
|
public Vector3f getDirection() {
|
||||||
@ -475,8 +476,8 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>setDirection</code> sets the direction vector of the ray.
|
* <code>setDirection</code> sets the direction vector of the ray.
|
||||||
|
*
|
||||||
* @param direction the direction of the ray.
|
* @param direction the direction of the ray.
|
||||||
*/
|
*/
|
||||||
public void setDirection(Vector3f direction) {
|
public void setDirection(Vector3f direction) {
|
||||||
|
@ -34,9 +34,7 @@ package com.jme3.math;
|
|||||||
import com.jme3.export.*;
|
import com.jme3.export.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>Rectangle</code> defines a finite plane within three dimensional space
|
* <code>Rectangle</code> defines a finite plane within three dimensional space
|
||||||
* that is specified via three points (A, B, C). These three points define a
|
* that is specified via three points (A, B, C). These three points define a
|
||||||
* triangle with the fourth point defining the rectangle ((B + C) - A.
|
* triangle with the fourth point defining the rectangle ((B + C) - A.
|
||||||
@ -44,9 +42,7 @@ import java.io.IOException;
|
|||||||
* @author Mark Powell
|
* @author Mark Powell
|
||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class Rectangle implements Savable, Cloneable, java.io.Serializable {
|
public final class Rectangle implements Savable, Cloneable, java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private Vector3f a, b, c;
|
private Vector3f a, b, c;
|
||||||
@ -54,7 +50,6 @@ public final class Rectangle implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* Constructor creates a new <code>Rectangle</code> with no defined corners.
|
* Constructor creates a new <code>Rectangle</code> with no defined corners.
|
||||||
* A, B, and C must be set to define a valid rectangle.
|
* A, B, and C must be set to define a valid rectangle.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public Rectangle() {
|
public Rectangle() {
|
||||||
a = new Vector3f();
|
a = new Vector3f();
|
||||||
@ -66,12 +61,9 @@ public final class Rectangle implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Constructor creates a new <code>Rectangle</code> with defined A, B, and C
|
* Constructor creates a new <code>Rectangle</code> with defined A, B, and C
|
||||||
* points that define the area of the rectangle.
|
* points that define the area of the rectangle.
|
||||||
*
|
*
|
||||||
* @param a
|
* @param a the first corner of the rectangle.
|
||||||
* the first corner of the rectangle.
|
* @param b the second corner of the rectangle.
|
||||||
* @param b
|
* @param c the third corner of the rectangle.
|
||||||
* the second corner of the rectangle.
|
|
||||||
* @param c
|
|
||||||
* the third corner of the rectangle.
|
|
||||||
*/
|
*/
|
||||||
public Rectangle(Vector3f a, Vector3f b, Vector3f c) {
|
public Rectangle(Vector3f a, Vector3f b, Vector3f c) {
|
||||||
this.a = a;
|
this.a = a;
|
||||||
@ -91,8 +83,7 @@ public final class Rectangle implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* <code>setA</code> sets the first point of the rectangle.
|
* <code>setA</code> sets the first point of the rectangle.
|
||||||
*
|
*
|
||||||
* @param a
|
* @param a the first point of the rectangle.
|
||||||
* the first point of the rectangle.
|
|
||||||
*/
|
*/
|
||||||
public void setA(Vector3f a) {
|
public void setA(Vector3f a) {
|
||||||
this.a = a;
|
this.a = a;
|
||||||
@ -110,8 +101,7 @@ public final class Rectangle implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* <code>setB</code> sets the second point of the rectangle.
|
* <code>setB</code> sets the second point of the rectangle.
|
||||||
*
|
*
|
||||||
* @param b
|
* @param b the second point of the rectangle.
|
||||||
* the second point of the rectangle.
|
|
||||||
*/
|
*/
|
||||||
public void setB(Vector3f b) {
|
public void setB(Vector3f b) {
|
||||||
this.b = b;
|
this.b = b;
|
||||||
@ -129,8 +119,7 @@ public final class Rectangle implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* <code>setC</code> sets the third point of the rectangle.
|
* <code>setC</code> sets the third point of the rectangle.
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c the third point of the rectangle.
|
||||||
* the third point of the rectangle.
|
|
||||||
*/
|
*/
|
||||||
public void setC(Vector3f c) {
|
public void setC(Vector3f c) {
|
||||||
this.c = c;
|
this.c = c;
|
||||||
|
@ -34,7 +34,6 @@ package com.jme3.math;
|
|||||||
import com.jme3.export.*;
|
import com.jme3.export.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>Ring</code> defines a flat ring or disk within three dimensional
|
* <code>Ring</code> defines a flat ring or disk within three dimensional
|
||||||
* space that is specified via the ring's center point, an up vector, an inner
|
* space that is specified via the ring's center point, an up vector, an inner
|
||||||
@ -43,9 +42,7 @@ import java.io.IOException;
|
|||||||
* @author Andrzej Kapolka
|
* @author Andrzej Kapolka
|
||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private Vector3f center, up;
|
private Vector3f center, up;
|
||||||
@ -162,7 +159,6 @@ public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>random</code> returns a random point within the ring.
|
* <code>random</code> returns a random point within the ring.
|
||||||
*
|
*
|
||||||
* @return a random point within the ring.
|
* @return a random point within the ring.
|
||||||
@ -172,7 +168,6 @@ public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>random</code> returns a random point within the ring.
|
* <code>random</code> returns a random point within the ring.
|
||||||
*
|
*
|
||||||
* @param result Vector to store result in
|
* @param result Vector to store result in
|
||||||
@ -184,11 +179,10 @@ public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute a random radius according to the ring area distribution
|
// compute a random radius according to the ring area distribution
|
||||||
float inner2 = innerRadius * innerRadius, outer2 = outerRadius
|
float inner2 = innerRadius * innerRadius,
|
||||||
* outerRadius, r = FastMath.sqrt(inner2
|
outer2 = outerRadius * outerRadius,
|
||||||
+ FastMath.nextRandomFloat() * (outer2 - inner2)), theta = FastMath
|
r = FastMath.sqrt(inner2 + FastMath.nextRandomFloat() * (outer2 - inner2)),
|
||||||
.nextRandomFloat()
|
theta = FastMath.nextRandomFloat() * FastMath.TWO_PI;
|
||||||
* FastMath.TWO_PI;
|
|
||||||
up.cross(Vector3f.UNIT_X, b1);
|
up.cross(Vector3f.UNIT_X, b1);
|
||||||
if (b1.lengthSquared() < FastMath.FLT_EPSILON) {
|
if (b1.lengthSquared() < FastMath.FLT_EPSILON) {
|
||||||
up.cross(Vector3f.UNIT_Y, b1);
|
up.cross(Vector3f.UNIT_Y, b1);
|
||||||
@ -212,10 +206,8 @@ public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
|||||||
@Override
|
@Override
|
||||||
public void read(JmeImporter e) throws IOException {
|
public void read(JmeImporter e) throws IOException {
|
||||||
InputCapsule capsule = e.getCapsule(this);
|
InputCapsule capsule = e.getCapsule(this);
|
||||||
center = (Vector3f) capsule.readSavable("center",
|
center = (Vector3f) capsule.readSavable("center", Vector3f.ZERO.clone());
|
||||||
Vector3f.ZERO.clone());
|
up = (Vector3f) capsule.readSavable("up", Vector3f.UNIT_Z.clone());
|
||||||
up = (Vector3f) capsule
|
|
||||||
.readSavable("up", Vector3f.UNIT_Z.clone());
|
|
||||||
innerRadius = capsule.readFloat("innerRadius", 0f);
|
innerRadius = capsule.readFloat("innerRadius", 0f);
|
||||||
outerRadius = capsule.readFloat("outerRadius", 1f);
|
outerRadius = capsule.readFloat("outerRadius", 1f);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2018 jMonkeyEngine
|
* Copyright (c) 2009-2020 jMonkeyEngine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -45,7 +45,6 @@ import java.io.IOException;
|
|||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
public class Triangle extends AbstractTriangle implements Savable, Cloneable, java.io.Serializable {
|
public class Triangle extends AbstractTriangle implements Savable, Cloneable, java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private Vector3f pointa = new Vector3f();
|
private Vector3f pointa = new Vector3f();
|
||||||
@ -67,6 +66,7 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
* supplied vectors as the points. It is recommended that the vertices
|
* supplied vectors as the points. It is recommended that the vertices
|
||||||
* be supplied in a counter clockwise winding to support normals for a
|
* be supplied in a counter clockwise winding to support normals for a
|
||||||
* right handed coordinate system.
|
* right handed coordinate system.
|
||||||
|
*
|
||||||
* @param p1 the first point of the triangle.
|
* @param p1 the first point of the triangle.
|
||||||
* @param p2 the second point of the triangle.
|
* @param p2 the second point of the triangle.
|
||||||
* @param p3 the third point of the triangle.
|
* @param p3 the third point of the triangle.
|
||||||
@ -231,7 +231,6 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* calculateCenter finds the average point of the triangle.
|
* calculateCenter finds the average point of the triangle.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public void calculateCenter() {
|
public void calculateCenter() {
|
||||||
if (center == null) {
|
if (center == null) {
|
||||||
@ -258,6 +257,7 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* obtains the center point of this triangle (average of the three triangles)
|
* obtains the center point of this triangle (average of the three triangles)
|
||||||
|
*
|
||||||
* @return the center point.
|
* @return the center point.
|
||||||
*/
|
*/
|
||||||
public Vector3f getCenter() {
|
public Vector3f getCenter() {
|
||||||
@ -269,6 +269,7 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the center point of this triangle (average of the three triangles)
|
* sets the center point of this triangle (average of the three triangles)
|
||||||
|
*
|
||||||
* @param center the center point.
|
* @param center the center point.
|
||||||
*/
|
*/
|
||||||
public void setCenter(Vector3f center) {
|
public void setCenter(Vector3f center) {
|
||||||
@ -290,6 +291,7 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the normal vector of this triangle (to conform, must be unit length)
|
* sets the normal vector of this triangle (to conform, must be unit length)
|
||||||
|
*
|
||||||
* @param normal the normal vector.
|
* @param normal the normal vector.
|
||||||
*/
|
*/
|
||||||
public void setNormal(Vector3f normal) {
|
public void setNormal(Vector3f normal) {
|
||||||
@ -298,6 +300,7 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* obtains the projection of the vertices relative to the line origin.
|
* obtains the projection of the vertices relative to the line origin.
|
||||||
|
*
|
||||||
* @return the projection of the triangle.
|
* @return the projection of the triangle.
|
||||||
*/
|
*/
|
||||||
public float getProjection() {
|
public float getProjection() {
|
||||||
@ -306,6 +309,7 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the projection of the vertices relative to the line origin.
|
* sets the projection of the vertices relative to the line origin.
|
||||||
|
*
|
||||||
* @param projection the projection of the triangle.
|
* @param projection the projection of the triangle.
|
||||||
*/
|
*/
|
||||||
public void setProjection(float projection) {
|
public void setProjection(float projection) {
|
||||||
@ -314,6 +318,7 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* obtains an index that this triangle represents if it is contained in a OBBTree.
|
* obtains an index that this triangle represents if it is contained in a OBBTree.
|
||||||
|
*
|
||||||
* @return the index in an OBBtree
|
* @return the index in an OBBtree
|
||||||
*/
|
*/
|
||||||
public int getIndex() {
|
public int getIndex() {
|
||||||
@ -322,6 +327,7 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* sets an index that this triangle represents if it is contained in a OBBTree.
|
* sets an index that this triangle represents if it is contained in a OBBTree.
|
||||||
|
*
|
||||||
* @param index the index in an OBBtree
|
* @param index the index in an OBBtree
|
||||||
*/
|
*/
|
||||||
public void setIndex(int index) {
|
public void setIndex(int index) {
|
||||||
|
@ -44,13 +44,11 @@ import java.util.logging.Logger;
|
|||||||
* @author Joshua Slack
|
* @author Joshua Slack
|
||||||
*/
|
*/
|
||||||
public final class Vector2f implements Savable, Cloneable, java.io.Serializable {
|
public final class Vector2f implements Savable, Cloneable, java.io.Serializable {
|
||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
private static final Logger logger = Logger.getLogger(Vector2f.class.getName());
|
private static final Logger logger = Logger.getLogger(Vector2f.class.getName());
|
||||||
|
|
||||||
public static final Vector2f ZERO = new Vector2f(0f, 0f);
|
public static final Vector2f ZERO = new Vector2f(0f, 0f);
|
||||||
public static final Vector2f UNIT_XY = new Vector2f(1f, 1f);
|
public static final Vector2f UNIT_XY = new Vector2f(1f, 1f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the x value of the vector.
|
* the x value of the vector.
|
||||||
*/
|
*/
|
||||||
@ -63,10 +61,8 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* Creates a Vector2f with the given initial x and y values.
|
* Creates a Vector2f with the given initial x and y values.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x The x value of this Vector2f.
|
||||||
* The x value of this Vector2f.
|
* @param y The y value of this Vector2f.
|
||||||
* @param y
|
|
||||||
* The y value of this Vector2f.
|
|
||||||
*/
|
*/
|
||||||
public Vector2f(float x, float y) {
|
public Vector2f(float x, float y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@ -94,10 +90,8 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* set the x and y values of the vector
|
* set the x and y values of the vector
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x the x value of the vector.
|
||||||
* the x value of the vector.
|
* @param y the y value of the vector.
|
||||||
* @param y
|
|
||||||
* the y value of the vector.
|
|
||||||
* @return this vector
|
* @return this vector
|
||||||
*/
|
*/
|
||||||
public Vector2f set(float x, float y) {
|
public Vector2f set(float x, float y) {
|
||||||
@ -187,8 +181,9 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
logger.warning("Provided vector is null, null returned.");
|
logger.warning("Provided vector is null, null returned.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (result == null)
|
if (result == null) {
|
||||||
result = new Vector2f();
|
result = new Vector2f();
|
||||||
|
}
|
||||||
result.x = x + vec.x;
|
result.x = x + vec.x;
|
||||||
result.y = y + vec.y;
|
result.y = y + vec.y;
|
||||||
return result;
|
return result;
|
||||||
@ -214,8 +209,7 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>cross</code> calculates the cross product of this vector with a
|
* <code>cross</code> calculates the cross product of this vector with a
|
||||||
* parameter vector v.
|
* parameter vector v.
|
||||||
*
|
*
|
||||||
* @param v
|
* @param v the vector to take the cross product of with this.
|
||||||
* the vector to take the cross product of with this.
|
|
||||||
* @return the cross product vector.
|
* @return the cross product vector.
|
||||||
*/
|
*/
|
||||||
public Vector3f cross(Vector2f v) {
|
public Vector3f cross(Vector2f v) {
|
||||||
@ -272,11 +266,17 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* @return true or false as stated above.
|
* @return true or false as stated above.
|
||||||
*/
|
*/
|
||||||
public static boolean isValidVector(Vector2f vector) {
|
public static boolean isValidVector(Vector2f vector) {
|
||||||
if (vector == null) return false;
|
if (vector == null) {
|
||||||
if (Float.isNaN(vector.x) ||
|
return false;
|
||||||
Float.isNaN(vector.y)) return false;
|
}
|
||||||
if (Float.isInfinite(vector.x) ||
|
if (Float.isNaN(vector.x)
|
||||||
Float.isInfinite(vector.y)) return false;
|
|| Float.isNaN(vector.y)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Float.isInfinite(vector.x)
|
||||||
|
|| Float.isInfinite(vector.y)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,8 +477,9 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* @return the result vector.
|
* @return the result vector.
|
||||||
*/
|
*/
|
||||||
public Vector2f subtract(Vector2f vec, Vector2f store) {
|
public Vector2f subtract(Vector2f vec, Vector2f store) {
|
||||||
if (store == null)
|
if (store == null) {
|
||||||
store = new Vector2f();
|
store = new Vector2f();
|
||||||
|
}
|
||||||
store.x = x - vec.x;
|
store.x = x - vec.x;
|
||||||
store.y = y - vec.y;
|
store.y = y - vec.y;
|
||||||
return store;
|
return store;
|
||||||
@ -611,6 +612,7 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
this.y = y;
|
this.y = y;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>getAngle</code> returns (in radians) the angle represented by
|
* <code>getAngle</code> returns (in radians) the angle represented by
|
||||||
* this Vector2f as expressed by a conversion from rectangular coordinates (<code>x</code>, <code>y</code>)
|
* this Vector2f as expressed by a conversion from rectangular coordinates (<code>x</code>, <code>y</code>)
|
||||||
@ -677,8 +679,7 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* are these two vectors the same? they are is they both have the same x and
|
* are these two vectors the same? they are is they both have the same x and
|
||||||
* y values.
|
* y values.
|
||||||
*
|
*
|
||||||
* @param o
|
* @param o the object to compare for equality
|
||||||
* the object to compare for equality
|
|
||||||
* @return true if they are equal
|
* @return true if they are equal
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -692,10 +693,12 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector2f comp = (Vector2f) o;
|
Vector2f comp = (Vector2f) o;
|
||||||
if (Float.compare(x, comp.x) != 0)
|
if (Float.compare(x, comp.x) != 0) {
|
||||||
return false;
|
return false;
|
||||||
if (Float.compare(y, comp.y) != 0)
|
}
|
||||||
|
if (Float.compare(y, comp.y) != 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,8 +778,9 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void rotateAroundOrigin(float angle, boolean cw) {
|
public void rotateAroundOrigin(float angle, boolean cw) {
|
||||||
if (cw)
|
if (cw) {
|
||||||
angle = -angle;
|
angle = -angle;
|
||||||
|
}
|
||||||
float newX = FastMath.cos(angle) * x - FastMath.sin(angle) * y;
|
float newX = FastMath.cos(angle) * x - FastMath.sin(angle) * y;
|
||||||
float newY = FastMath.sin(angle) * x + FastMath.cos(angle) * y;
|
float newY = FastMath.sin(angle) * x + FastMath.cos(angle) * y;
|
||||||
x = newX;
|
x = newX;
|
||||||
|
@ -93,12 +93,9 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Constructor instantiates a new <code>Vector3f</code> with provides
|
* Constructor instantiates a new <code>Vector3f</code> with provides
|
||||||
* values.
|
* values.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x the x value of the vector.
|
||||||
* the x value of the vector.
|
* @param y the y value of the vector.
|
||||||
* @param y
|
* @param z the z value of the vector.
|
||||||
* the y value of the vector.
|
|
||||||
* @param z
|
|
||||||
* the z value of the vector.
|
|
||||||
*/
|
*/
|
||||||
public Vector3f(float x, float y, float z) {
|
public Vector3f(float x, float y, float z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@ -109,6 +106,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* Constructor instantiates a new <code>Vector3f</code> that is a copy
|
* Constructor instantiates a new <code>Vector3f</code> that is a copy
|
||||||
* of the provided vector
|
* of the provided vector
|
||||||
|
*
|
||||||
* @param copy The Vector3f to copy
|
* @param copy The Vector3f to copy
|
||||||
*/
|
*/
|
||||||
public Vector3f(Vector3f copy) {
|
public Vector3f(Vector3f copy) {
|
||||||
@ -119,12 +117,9 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>set</code> sets the x,y,z values of the vector based on passed
|
* <code>set</code> sets the x,y,z values of the vector based on passed
|
||||||
* parameters.
|
* parameters.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x the x value of the vector.
|
||||||
* the x value of the vector.
|
* @param y the y value of the vector.
|
||||||
* @param y
|
* @param z the z value of the vector.
|
||||||
* the y value of the vector.
|
|
||||||
* @param z
|
|
||||||
* the z value of the vector.
|
|
||||||
* @return this vector
|
* @return this vector
|
||||||
*/
|
*/
|
||||||
public Vector3f set(float x, float y, float z) {
|
public Vector3f set(float x, float y, float z) {
|
||||||
@ -295,8 +290,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>cross</code> calculates the cross product of this vector with a
|
* <code>cross</code> calculates the cross product of this vector with a
|
||||||
* parameter vector v.
|
* parameter vector v.
|
||||||
*
|
*
|
||||||
* @param v
|
* @param v the vector to take the cross product of with this.
|
||||||
* the vector to take the cross product of with this.
|
|
||||||
* @return the cross product vector.
|
* @return the cross product vector.
|
||||||
*/
|
*/
|
||||||
public Vector3f cross(Vector3f v) {
|
public Vector3f cross(Vector3f v) {
|
||||||
@ -307,8 +301,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>cross</code> calculates the cross product of this vector with a
|
* <code>cross</code> calculates the cross product of this vector with a
|
||||||
* parameter vector v. The result is stored in <code>result</code>
|
* parameter vector v. The result is stored in <code>result</code>
|
||||||
*
|
*
|
||||||
* @param v
|
* @param v the vector to take the cross product of with this.
|
||||||
* the vector to take the cross product of with this.
|
|
||||||
* @param result
|
* @param result
|
||||||
* the vector to store the cross product result.
|
* the vector to store the cross product result.
|
||||||
* @return result, after receiving the cross product vector.
|
* @return result, after receiving the cross product vector.
|
||||||
@ -346,8 +339,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>crossLocal</code> calculates the cross product of this vector
|
* <code>crossLocal</code> calculates the cross product of this vector
|
||||||
* with a parameter vector v.
|
* with a parameter vector v.
|
||||||
*
|
*
|
||||||
* @param v
|
* @param v the vector to take the cross product of with this.
|
||||||
* the vector to take the cross product of with this.
|
|
||||||
* @return this.
|
* @return this.
|
||||||
*/
|
*/
|
||||||
public Vector3f crossLocal(Vector3f v) {
|
public Vector3f crossLocal(Vector3f v) {
|
||||||
@ -817,6 +809,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>zero</code> resets this vector's data to zero internally.
|
* <code>zero</code> resets this vector's data to zero internally.
|
||||||
|
*
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Vector3f zero() {
|
public Vector3f zero() {
|
||||||
@ -955,8 +948,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* are these two vectors the same? they are is they both have the same x,y,
|
* are these two vectors the same? they are is they both have the same x,y,
|
||||||
* and z values.
|
* and z values.
|
||||||
*
|
*
|
||||||
* @param o
|
* @param o the object to compare for equality
|
||||||
* the object to compare for equality
|
|
||||||
* @return true if they are equal
|
* @return true if they are equal
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -1080,8 +1072,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param index
|
* @param index
|
||||||
* @return x value if index == 0, y value if index == 1 or z value if index ==
|
* @return x value if index == 0, y value if index == 1 or z value if index == 2
|
||||||
* 2
|
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if index is not one of 0, 1, 2.
|
* if index is not one of 0, 1, 2.
|
||||||
*/
|
*/
|
||||||
|
@ -66,22 +66,18 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
Float.NEGATIVE_INFINITY,
|
Float.NEGATIVE_INFINITY,
|
||||||
Float.NEGATIVE_INFINITY,
|
Float.NEGATIVE_INFINITY,
|
||||||
Float.NEGATIVE_INFINITY);
|
Float.NEGATIVE_INFINITY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the x value of the vector.
|
* the x value of the vector.
|
||||||
*/
|
*/
|
||||||
public float x;
|
public float x;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the y value of the vector.
|
* the y value of the vector.
|
||||||
*/
|
*/
|
||||||
public float y;
|
public float y;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the z value of the vector.
|
* the z value of the vector.
|
||||||
*/
|
*/
|
||||||
public float z;
|
public float z;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the w value of the vector.
|
* the w value of the vector.
|
||||||
*/
|
*/
|
||||||
@ -100,14 +96,10 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* Constructor instantiates a new <code>Vector4f</code> with provides
|
* Constructor instantiates a new <code>Vector4f</code> with provides
|
||||||
* values.
|
* values.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x the x value of the vector.
|
||||||
* the x value of the vector.
|
* @param y the y value of the vector.
|
||||||
* @param y
|
* @param z the z value of the vector.
|
||||||
* the y value of the vector.
|
* @param w the w value of the vector.
|
||||||
* @param z
|
|
||||||
* the z value of the vector.
|
|
||||||
* @param w
|
|
||||||
* the w value of the vector.
|
|
||||||
*/
|
*/
|
||||||
public Vector4f(float x, float y, float z, float w) {
|
public Vector4f(float x, float y, float z, float w) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@ -119,6 +111,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* Constructor instantiates a new <code>Vector3f</code> that is a copy
|
* Constructor instantiates a new <code>Vector3f</code> that is a copy
|
||||||
* of the provided vector
|
* of the provided vector
|
||||||
|
*
|
||||||
* @param copy The Vector3f to copy
|
* @param copy The Vector3f to copy
|
||||||
*/
|
*/
|
||||||
public Vector4f(Vector4f copy) {
|
public Vector4f(Vector4f copy) {
|
||||||
@ -129,14 +122,10 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>set</code> sets the x,y,z,w values of the vector based on passed
|
* <code>set</code> sets the x,y,z,w values of the vector based on passed
|
||||||
* parameters.
|
* parameters.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x the x value of the vector.
|
||||||
* the x value of the vector.
|
* @param y the y value of the vector.
|
||||||
* @param y
|
* @param z the z value of the vector.
|
||||||
* the y value of the vector.
|
* @param w the w value of the vector.
|
||||||
* @param z
|
|
||||||
* the z value of the vector.
|
|
||||||
* @param w
|
|
||||||
* the w value of the vector.
|
|
||||||
* @return this vector
|
* @return this vector
|
||||||
*/
|
*/
|
||||||
public Vector4f set(float x, float y, float z, float w) {
|
public Vector4f set(float x, float y, float z, float w) {
|
||||||
@ -164,7 +153,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>add</code> adds a provided vector to this vector creating a
|
* <code>add</code> adds a provided vector to this vector creating a
|
||||||
* resultant vector which is returned. If the provided vector is null, null
|
* resultant vector which is returned. If the provided vector is null, null
|
||||||
* is returned.
|
* is returned.
|
||||||
@ -182,7 +170,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>add</code> adds the values of a provided vector storing the
|
* <code>add</code> adds the values of a provided vector storing the
|
||||||
* values in the supplied vector.
|
* values in the supplied vector.
|
||||||
*
|
*
|
||||||
@ -222,7 +209,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>add</code> adds the provided values to this vector, creating a
|
* <code>add</code> adds the provided values to this vector, creating a
|
||||||
* new vector that is then returned.
|
* new vector that is then returned.
|
||||||
*
|
*
|
||||||
@ -264,7 +250,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>scaleAdd</code> multiplies this vector by a scalar then adds the
|
* <code>scaleAdd</code> multiplies this vector by a scalar then adds the
|
||||||
* given Vector3f.
|
* given Vector3f.
|
||||||
*
|
*
|
||||||
@ -283,7 +268,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>scaleAdd</code> multiplies the given vector by a scalar then adds
|
* <code>scaleAdd</code> multiplies the given vector by a scalar then adds
|
||||||
* the given vector.
|
* the given vector.
|
||||||
*
|
*
|
||||||
@ -304,7 +288,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>dot</code> calculates the dot product of this vector with a
|
* <code>dot</code> calculates the dot product of this vector with a
|
||||||
* provided vector. If the provided vector is null, 0 is returned.
|
* provided vector. If the provided vector is null, 0 is returned.
|
||||||
*
|
*
|
||||||
@ -320,10 +303,10 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
return x * vec.x + y * vec.y + z * vec.z + w * vec.w;
|
return x * vec.x + y * vec.y + z * vec.z + w * vec.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector4f project(Vector4f other){
|
public Vector4f project(Vector4f other) {
|
||||||
float n = this.dot(other); // A . B
|
float n = this.dot(other); // A . B
|
||||||
float d = other.lengthSquared(); // |B|^2
|
float d = other.lengthSquared(); // |B|^2
|
||||||
return new Vector4f(other).multLocal(n/d);
|
return new Vector4f(other).multLocal(n / d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -333,7 +316,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* @return true if this vector is a unit vector (length() ~= 1),
|
* @return true if this vector is a unit vector (length() ~= 1),
|
||||||
* or false otherwise.
|
* or false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isUnitVector(){
|
public boolean isUnitVector() {
|
||||||
float len = length();
|
float len = length();
|
||||||
return 0.99f < len && len < 1.01f;
|
return 0.99f < len && len < 1.01f;
|
||||||
}
|
}
|
||||||
@ -384,7 +367,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>mult</code> multiplies this vector by a scalar. The resultant
|
* <code>mult</code> multiplies this vector by a scalar. The resultant
|
||||||
* vector is returned.
|
* vector is returned.
|
||||||
*
|
*
|
||||||
@ -397,7 +379,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>mult</code> multiplies this vector by a scalar. The resultant
|
* <code>mult</code> multiplies this vector by a scalar. The resultant
|
||||||
* vector is supplied as the second parameter and returned.
|
* vector is supplied as the second parameter and returned.
|
||||||
*
|
*
|
||||||
@ -505,7 +486,9 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
logger.warning("Provided vector is null, null returned.");
|
logger.warning("Provided vector is null, null returned.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (store == null) store = new Vector4f();
|
if (store == null) {
|
||||||
|
store = new Vector4f();
|
||||||
|
}
|
||||||
return store.set(x * vec.x, y * vec.y, z * vec.z, w * vec.w);
|
return store.set(x * vec.x, y * vec.y, z * vec.z, w * vec.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +501,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* @return the result <code>Vector</code>.
|
* @return the result <code>Vector</code>.
|
||||||
*/
|
*/
|
||||||
public Vector4f divide(float scalar) {
|
public Vector4f divide(float scalar) {
|
||||||
scalar = 1f/scalar;
|
scalar = 1f / scalar;
|
||||||
return new Vector4f(x * scalar, y * scalar, z * scalar, w * scalar);
|
return new Vector4f(x * scalar, y * scalar, z * scalar, w * scalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +515,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Vector4f divideLocal(float scalar) {
|
public Vector4f divideLocal(float scalar) {
|
||||||
scalar = 1f/scalar;
|
scalar = 1f / scalar;
|
||||||
x *= scalar;
|
x *= scalar;
|
||||||
y *= scalar;
|
y *= scalar;
|
||||||
z *= scalar;
|
z *= scalar;
|
||||||
@ -570,7 +553,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>negate</code> returns the negative of this vector. All values are
|
* <code>negate</code> returns the negative of this vector. All values are
|
||||||
* negated and set to a new vector.
|
* negated and set to a new vector.
|
||||||
*
|
*
|
||||||
@ -581,7 +563,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>negateLocal</code> negates the internal values of this vector.
|
* <code>negateLocal</code> negates the internal values of this vector.
|
||||||
*
|
*
|
||||||
* @return this.
|
* @return this.
|
||||||
@ -595,7 +576,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>subtract</code> subtracts the values of a given vector from those
|
* <code>subtract</code> subtracts the values of a given vector from those
|
||||||
* of this vector creating a new vector object. If the provided vector is
|
* of this vector creating a new vector object. If the provided vector is
|
||||||
* null, null is returned.
|
* null, null is returned.
|
||||||
@ -630,7 +610,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>subtract</code>
|
* <code>subtract</code>
|
||||||
*
|
*
|
||||||
* @param vec
|
* @param vec
|
||||||
@ -640,7 +619,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* @return result
|
* @return result
|
||||||
*/
|
*/
|
||||||
public Vector4f subtract(Vector4f vec, Vector4f result) {
|
public Vector4f subtract(Vector4f vec, Vector4f result) {
|
||||||
if(result == null) {
|
if (result == null) {
|
||||||
result = new Vector4f();
|
result = new Vector4f();
|
||||||
}
|
}
|
||||||
result.x = x - vec.x;
|
result.x = x - vec.x;
|
||||||
@ -651,7 +630,6 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* <code>subtract</code> subtracts the provided values from this vector,
|
* <code>subtract</code> subtracts the provided values from this vector,
|
||||||
* creating a new vector that is then returned.
|
* creating a new vector that is then returned.
|
||||||
*
|
*
|
||||||
@ -705,7 +683,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
//
|
//
|
||||||
// return divide(1);
|
// return divide(1);
|
||||||
float length = x * x + y * y + z * z + w * w;
|
float length = x * x + y * y + z * z + w * w;
|
||||||
if (length != 1f && length != 0f){
|
if (length != 1f && length != 0f) {
|
||||||
length = 1.0f / FastMath.sqrt(length);
|
length = 1.0f / FastMath.sqrt(length);
|
||||||
return new Vector4f(x * length, y * length, z * length, w * length);
|
return new Vector4f(x * length, y * length, z * length, w * length);
|
||||||
}
|
}
|
||||||
@ -723,7 +701,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
// than the old jme normalize as this method
|
// than the old jme normalize as this method
|
||||||
// is commonly used.
|
// is commonly used.
|
||||||
float length = x * x + y * y + z * z + w * w;
|
float length = x * x + y * y + z * z + w * w;
|
||||||
if (length != 1f && length != 0f){
|
if (length != 1f && length != 0f) {
|
||||||
length = 1.0f / FastMath.sqrt(length);
|
length = 1.0f / FastMath.sqrt(length);
|
||||||
x *= length;
|
x *= length;
|
||||||
y *= length;
|
y *= length;
|
||||||
@ -737,10 +715,11 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>maxLocal</code> computes the maximum value for each
|
* <code>maxLocal</code> computes the maximum value for each
|
||||||
* component in this and <code>other</code> vector. The result is stored
|
* component in this and <code>other</code> vector. The result is stored
|
||||||
* in this vector.
|
* in this vector.
|
||||||
|
*
|
||||||
* @param other
|
* @param other
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Vector4f maxLocal(Vector4f other){
|
public Vector4f maxLocal(Vector4f other) {
|
||||||
x = other.x > x ? other.x : x;
|
x = other.x > x ? other.x : x;
|
||||||
y = other.y > y ? other.y : y;
|
y = other.y > y ? other.y : y;
|
||||||
z = other.z > z ? other.z : z;
|
z = other.z > z ? other.z : z;
|
||||||
@ -752,10 +731,11 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>minLocal</code> computes the minimum value for each
|
* <code>minLocal</code> computes the minimum value for each
|
||||||
* component in this and <code>other</code> vector. The result is stored
|
* component in this and <code>other</code> vector. The result is stored
|
||||||
* in this vector.
|
* in this vector.
|
||||||
|
*
|
||||||
* @param other
|
* @param other
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Vector4f minLocal(Vector4f other){
|
public Vector4f minLocal(Vector4f other) {
|
||||||
x = other.x < x ? other.x : x;
|
x = other.x < x ? other.x : x;
|
||||||
y = other.y < y ? other.y : y;
|
y = other.y < y ? other.y : y;
|
||||||
z = other.z < z ? other.z : z;
|
z = other.z < z ? other.z : z;
|
||||||
@ -789,52 +769,61 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
/**
|
/**
|
||||||
* Sets this vector to the interpolation by changeAmnt from this to the finalVec
|
* Sets this vector to the interpolation by changeAmnt from this to the finalVec
|
||||||
* this=(1-changeAmnt)*this + changeAmnt * finalVec
|
* this=(1-changeAmnt)*this + changeAmnt * finalVec
|
||||||
|
*
|
||||||
* @param finalVec The final vector to interpolate towards
|
* @param finalVec The final vector to interpolate towards
|
||||||
* @param changeAmnt An amount between 0.0 - 1.0 representing a percentage
|
* @param changeAmnt An amount between 0.0 - 1.0 representing a percentage
|
||||||
* change from this towards finalVec
|
* change from this towards finalVec
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Vector4f interpolateLocal(Vector4f finalVec, float changeAmnt) {
|
public Vector4f interpolateLocal(Vector4f finalVec, float changeAmnt) {
|
||||||
this.x=(1-changeAmnt)*this.x + changeAmnt*finalVec.x;
|
this.x = (1 - changeAmnt) * this.x + changeAmnt * finalVec.x;
|
||||||
this.y=(1-changeAmnt)*this.y + changeAmnt*finalVec.y;
|
this.y = (1 - changeAmnt) * this.y + changeAmnt * finalVec.y;
|
||||||
this.z=(1-changeAmnt)*this.z + changeAmnt*finalVec.z;
|
this.z = (1 - changeAmnt) * this.z + changeAmnt * finalVec.z;
|
||||||
this.w=(1-changeAmnt)*this.w + changeAmnt*finalVec.w;
|
this.w = (1 - changeAmnt) * this.w + changeAmnt * finalVec.w;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this vector to the interpolation by changeAmnt from beginVec to finalVec
|
* Sets this vector to the interpolation by changeAmnt from beginVec to finalVec
|
||||||
* this=(1-changeAmnt)*beginVec + changeAmnt * finalVec
|
* this=(1-changeAmnt)*beginVec + changeAmnt * finalVec
|
||||||
|
*
|
||||||
* @param beginVec the beginning vector (changeAmnt=0)
|
* @param beginVec the beginning vector (changeAmnt=0)
|
||||||
* @param finalVec The final vector to interpolate towards
|
* @param finalVec The final vector to interpolate towards
|
||||||
* @param changeAmnt An amount between 0.0 - 1.0 representing a percentage
|
* @param changeAmnt An amount between 0.0 - 1.0 representing a percentage
|
||||||
* change from beginVec towards finalVec
|
* change from beginVec towards finalVec
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Vector4f interpolateLocal(Vector4f beginVec,Vector4f finalVec, float changeAmnt) {
|
public Vector4f interpolateLocal(Vector4f beginVec, Vector4f finalVec, float changeAmnt) {
|
||||||
this.x=(1-changeAmnt)*beginVec.x + changeAmnt*finalVec.x;
|
this.x = (1 - changeAmnt) * beginVec.x + changeAmnt * finalVec.x;
|
||||||
this.y=(1-changeAmnt)*beginVec.y + changeAmnt*finalVec.y;
|
this.y = (1 - changeAmnt) * beginVec.y + changeAmnt * finalVec.y;
|
||||||
this.z=(1-changeAmnt)*beginVec.z + changeAmnt*finalVec.z;
|
this.z = (1 - changeAmnt) * beginVec.z + changeAmnt * finalVec.z;
|
||||||
this.w=(1-changeAmnt)*beginVec.w + changeAmnt*finalVec.w;
|
this.w = (1 - changeAmnt) * beginVec.w + changeAmnt * finalVec.w;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a vector... if it is null or its floats are NaN or infinite,
|
* Check a vector... if it is null or its floats are NaN or infinite,
|
||||||
* return false. Else return true.
|
* return false. Else return true.
|
||||||
|
*
|
||||||
* @param vector the vector to check
|
* @param vector the vector to check
|
||||||
* @return true or false as stated above.
|
* @return true or false as stated above.
|
||||||
*/
|
*/
|
||||||
public static boolean isValidVector(Vector4f vector) {
|
public static boolean isValidVector(Vector4f vector) {
|
||||||
if (vector == null) return false;
|
if (vector == null) {
|
||||||
if (Float.isNaN(vector.x) ||
|
return false;
|
||||||
Float.isNaN(vector.y) ||
|
}
|
||||||
Float.isNaN(vector.z)||
|
if (Float.isNaN(vector.x)
|
||||||
Float.isNaN(vector.w)) return false;
|
|| Float.isNaN(vector.y)
|
||||||
if (Float.isInfinite(vector.x) ||
|
|| Float.isNaN(vector.z)
|
||||||
Float.isInfinite(vector.y) ||
|
|| Float.isNaN(vector.w)) {
|
||||||
Float.isInfinite(vector.z) ||
|
return false;
|
||||||
Float.isInfinite(vector.w)) return false;
|
}
|
||||||
|
if (Float.isInfinite(vector.x)
|
||||||
|
|| Float.isInfinite(vector.y)
|
||||||
|
|| Float.isInfinite(vector.z)
|
||||||
|
|| Float.isInfinite(vector.w)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -870,21 +859,32 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* are these two vectors the same? they are is they both have the same x,y,
|
* are these two vectors the same? they are is they both have the same x,y,
|
||||||
* and z values.
|
* and z values.
|
||||||
*
|
*
|
||||||
* @param o
|
* @param o the object to compare for equality
|
||||||
* the object to compare for equality
|
|
||||||
* @return true if they are equal
|
* @return true if they are equal
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (!(o instanceof Vector4f)) { return false; }
|
if (!(o instanceof Vector4f)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this == o) { return true; }
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Vector4f comp = (Vector4f) o;
|
Vector4f comp = (Vector4f) o;
|
||||||
if (Float.compare(x,comp.x) != 0) return false;
|
if (Float.compare(x, comp.x) != 0) {
|
||||||
if (Float.compare(y,comp.y) != 0) return false;
|
return false;
|
||||||
if (Float.compare(z,comp.z) != 0) return false;
|
}
|
||||||
if (Float.compare(w,comp.w) != 0) return false;
|
if (Float.compare(y, comp.y) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Float.compare(z, comp.z) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Float.compare(w, comp.w) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,6 +919,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
* <code>hashCode</code> returns a unique code for this vector object based
|
* <code>hashCode</code> returns a unique code for this vector object based
|
||||||
* on its values. If two vectors are logically equivalent, they will return
|
* on its values. If two vectors are logically equivalent, they will return
|
||||||
* the same hash code value.
|
* the same hash code value.
|
||||||
|
*
|
||||||
* @return the hash code value of this vector.
|
* @return the hash code value of this vector.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -1000,8 +1001,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param index
|
* @param index
|
||||||
* @return x value if index == 0, y value if index == 1 or z value if index ==
|
* @return x value if index == 0, y value if index == 1 or z value if index == 2
|
||||||
* 2
|
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if index is not one of 0, 1, 2.
|
* if index is not one of 0, 1, 2.
|
||||||
*/
|
*/
|
||||||
@ -1044,5 +1044,4 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
throw new IllegalArgumentException("index must be either 0, 1, 2 or 3");
|
throw new IllegalArgumentException("index must be either 0, 1, 2 or 3");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user