add some more missing javadoc (11 files in com.jme3.math)
This commit is contained in:
parent
a1dcbf9b06
commit
a5e0213b01
@ -974,6 +974,18 @@ public final class Matrix4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
m00 = m11 = m22 = m33 = 1.0f;
|
m00 = m11 = m22 = m33 = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure this matrix to represent a perspective-view frustrum or
|
||||||
|
* rectangular solid with the specified clipping planes.
|
||||||
|
*
|
||||||
|
* @param near the coordinate of the near plane
|
||||||
|
* @param far the coordinate of the far plane
|
||||||
|
* @param left the coordinate of the left plane
|
||||||
|
* @param right the coordinate of the right plane
|
||||||
|
* @param top the coordinate of the top plane
|
||||||
|
* @param bottom the coordinate of the bottom plane
|
||||||
|
* @param parallel true → parallel sides, false → perspective
|
||||||
|
*/
|
||||||
public void fromFrustum(float near, float far, float left, float right,
|
public void fromFrustum(float near, float far, float left, float right,
|
||||||
float top, float bottom, boolean parallel) {
|
float top, float bottom, boolean parallel) {
|
||||||
loadIdentity();
|
loadIdentity();
|
||||||
|
@ -52,9 +52,21 @@ public class Plane implements Savable, Cloneable, java.io.Serializable {
|
|||||||
private static final Logger logger = Logger
|
private static final Logger logger = Logger
|
||||||
.getLogger(Plane.class.getName());
|
.getLogger(Plane.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describe the relationship between a point and a plane.
|
||||||
|
*/
|
||||||
public static enum Side {
|
public static enum Side {
|
||||||
|
/**
|
||||||
|
* a point that lies in the plane
|
||||||
|
*/
|
||||||
None,
|
None,
|
||||||
|
/**
|
||||||
|
* a point on the side with positive pseudo-distance
|
||||||
|
*/
|
||||||
Positive,
|
Positive,
|
||||||
|
/**
|
||||||
|
* a point on the side with negative pseudo-distance
|
||||||
|
*/
|
||||||
Negative
|
Negative
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,6 +405,12 @@ public final class Ray implements Savable, Cloneable, Collidable, java.io.Serial
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the squared distance from this ray to the specified point.
|
||||||
|
*
|
||||||
|
* @param point location vector of the input point (not null, unaffected)
|
||||||
|
* @return the square of the minimum distance (≥0)
|
||||||
|
*/
|
||||||
public float distanceSquared(Vector3f point) {
|
public float distanceSquared(Vector3f point) {
|
||||||
TempVars vars = TempVars.get();
|
TempVars vars = TempVars.get();
|
||||||
|
|
||||||
|
@ -156,6 +156,13 @@ public final class Rectangle implements Savable, Cloneable, java.io.Serializable
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this rectangle to the specified exporter, for example when
|
||||||
|
* saving to a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the exporter
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter e) throws IOException {
|
public void write(JmeExporter e) throws IOException {
|
||||||
OutputCapsule capsule = e.getCapsule(this);
|
OutputCapsule capsule = e.getCapsule(this);
|
||||||
@ -164,6 +171,13 @@ public final class Rectangle implements Savable, Cloneable, java.io.Serializable
|
|||||||
capsule.write(c, "c", Vector3f.ZERO);
|
capsule.write(c, "c", Vector3f.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize this rectangle from the specified importer, for example
|
||||||
|
* when loading from a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the importer
|
||||||
|
*/
|
||||||
@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);
|
||||||
@ -172,6 +186,11 @@ public final class Rectangle implements Savable, Cloneable, java.io.Serializable
|
|||||||
c = (Vector3f) capsule.readSavable("c", Vector3f.ZERO.clone());
|
c = (Vector3f) capsule.readSavable("c", Vector3f.ZERO.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a copy of this rectangle.
|
||||||
|
*
|
||||||
|
* @return a new instance, equivalent to this one
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Rectangle clone() {
|
public Rectangle clone() {
|
||||||
try {
|
try {
|
||||||
|
@ -194,6 +194,13 @@ public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this ring to the specified exporter, for example when
|
||||||
|
* saving to a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the exporter
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter e) throws IOException {
|
public void write(JmeExporter e) throws IOException {
|
||||||
OutputCapsule capsule = e.getCapsule(this);
|
OutputCapsule capsule = e.getCapsule(this);
|
||||||
@ -203,6 +210,13 @@ public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
|||||||
capsule.write(outerRadius, "outerRadius", 1f);
|
capsule.write(outerRadius, "outerRadius", 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize this ring from the specified importer, for example
|
||||||
|
* when loading from a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the importer
|
||||||
|
*/
|
||||||
@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);
|
||||||
@ -212,6 +226,11 @@ public final class Ring implements Savable, Cloneable, java.io.Serializable {
|
|||||||
outerRadius = capsule.readFloat("outerRadius", 1f);
|
outerRadius = capsule.readFloat("outerRadius", 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a copy of this ring.
|
||||||
|
*
|
||||||
|
* @return a new instance, equivalent to this one
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Ring clone() {
|
public Ring clone() {
|
||||||
try {
|
try {
|
||||||
|
@ -454,6 +454,13 @@ public class Spline implements Savable {
|
|||||||
return basisFunctionDegree;
|
return basisFunctionDegree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this spline to the specified exporter, for example when
|
||||||
|
* saving to a J3O file.
|
||||||
|
*
|
||||||
|
* @param ex (not null)
|
||||||
|
* @throws IOException from the exporter
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter ex) throws IOException {
|
public void write(JmeExporter ex) throws IOException {
|
||||||
OutputCapsule oc = ex.getCapsule(this);
|
OutputCapsule oc = ex.getCapsule(this);
|
||||||
@ -478,6 +485,13 @@ public class Spline implements Savable {
|
|||||||
oc.write(basisFunctionDegree, "basisFunctionDegree", 0);
|
oc.write(basisFunctionDegree, "basisFunctionDegree", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize this spline from the specified importer, for example
|
||||||
|
* when loading from a J3O file.
|
||||||
|
*
|
||||||
|
* @param im (not null)
|
||||||
|
* @throws IOException from the importer
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void read(JmeImporter im) throws IOException {
|
public void read(JmeImporter im) throws IOException {
|
||||||
|
@ -377,6 +377,13 @@ public final class Transform implements Savable, Cloneable, java.io.Serializable
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this transform to the specified exporter, for example when
|
||||||
|
* saving to a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the exporter
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter e) throws IOException {
|
public void write(JmeExporter e) throws IOException {
|
||||||
OutputCapsule capsule = e.getCapsule(this);
|
OutputCapsule capsule = e.getCapsule(this);
|
||||||
@ -385,6 +392,13 @@ public final class Transform implements Savable, Cloneable, java.io.Serializable
|
|||||||
capsule.write(scale, "scale", Vector3f.UNIT_XYZ);
|
capsule.write(scale, "scale", Vector3f.UNIT_XYZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize this transform from the specified importer, for example
|
||||||
|
* when loading from a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the importer
|
||||||
|
*/
|
||||||
@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);
|
||||||
@ -394,6 +408,11 @@ public final class Transform implements Savable, Cloneable, java.io.Serializable
|
|||||||
scale.set((Vector3f) capsule.readSavable("scale", Vector3f.UNIT_XYZ));
|
scale.set((Vector3f) capsule.readSavable("scale", Vector3f.UNIT_XYZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a copy of this transform.
|
||||||
|
*
|
||||||
|
* @return a new instance, equivalent to this one
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Transform clone() {
|
public Transform clone() {
|
||||||
try {
|
try {
|
||||||
|
@ -345,6 +345,13 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
return store.normalizeLocal();
|
return store.normalizeLocal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this triangle to the specified exporter, for example when
|
||||||
|
* saving to a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the exporter
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter e) throws IOException {
|
public void write(JmeExporter e) throws IOException {
|
||||||
e.getCapsule(this).write(pointa, "pointa", Vector3f.ZERO);
|
e.getCapsule(this).write(pointa, "pointa", Vector3f.ZERO);
|
||||||
@ -352,6 +359,13 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
e.getCapsule(this).write(pointc, "pointc", Vector3f.ZERO);
|
e.getCapsule(this).write(pointc, "pointc", Vector3f.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize this triangle from the specified importer, for example
|
||||||
|
* when loading from a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the importer
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void read(JmeImporter e) throws IOException {
|
public void read(JmeImporter e) throws IOException {
|
||||||
pointa = (Vector3f) e.getCapsule(this).readSavable("pointa", Vector3f.ZERO.clone());
|
pointa = (Vector3f) e.getCapsule(this).readSavable("pointa", Vector3f.ZERO.clone());
|
||||||
@ -359,6 +373,11 @@ public class Triangle extends AbstractTriangle implements Savable, Cloneable, ja
|
|||||||
pointc = (Vector3f) e.getCapsule(this).readSavable("pointc", Vector3f.ZERO.clone());
|
pointc = (Vector3f) e.getCapsule(this).readSavable("pointc", Vector3f.ZERO.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a copy of this triangle.
|
||||||
|
*
|
||||||
|
* @return a new instance, equivalent to this one
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Triangle clone() {
|
public Triangle clone() {
|
||||||
try {
|
try {
|
||||||
|
@ -46,8 +46,13 @@ import java.util.logging.Logger;
|
|||||||
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());
|
||||||
|
/**
|
||||||
|
* shared instance of the all-zero vector (0,0) - Do not modify!
|
||||||
|
*/
|
||||||
public static final Vector2f ZERO = new Vector2f(0f, 0f);
|
public static final Vector2f ZERO = new Vector2f(0f, 0f);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-ones vector (1,1) - Do not modify!
|
||||||
|
*/
|
||||||
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.
|
||||||
@ -595,19 +600,41 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the X component of this vector.
|
||||||
|
*
|
||||||
|
* @return x
|
||||||
|
*/
|
||||||
public float getX() {
|
public float getX() {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the X component of this vector.
|
||||||
|
*
|
||||||
|
* @param x the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector2f setX(float x) {
|
public Vector2f setX(float x) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the Y component of this vector.
|
||||||
|
*
|
||||||
|
* @return y
|
||||||
|
*/
|
||||||
public float getY() {
|
public float getY() {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the Y component of this vector.
|
||||||
|
*
|
||||||
|
* @param y the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector2f setY(float y) {
|
public Vector2f setY(float y) {
|
||||||
this.y = y;
|
this.y = y;
|
||||||
return this;
|
return this;
|
||||||
@ -649,6 +676,11 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a copy of this vector.
|
||||||
|
*
|
||||||
|
* @return a new instance, equivalent to this one
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Vector2f clone() {
|
public Vector2f clone() {
|
||||||
try {
|
try {
|
||||||
@ -764,6 +796,13 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
out.writeFloat(y);
|
out.writeFloat(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this vector to the specified exporter, for example when
|
||||||
|
* saving to a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the exporter
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter e) throws IOException {
|
public void write(JmeExporter e) throws IOException {
|
||||||
OutputCapsule capsule = e.getCapsule(this);
|
OutputCapsule capsule = e.getCapsule(this);
|
||||||
@ -771,6 +810,13 @@ public final class Vector2f implements Savable, Cloneable, java.io.Serializable
|
|||||||
capsule.write(y, "y", 0);
|
capsule.write(y, "y", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize this vector from the specified importer, for example
|
||||||
|
* when loading from a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the importer
|
||||||
|
*/
|
||||||
@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);
|
||||||
|
@ -52,17 +52,42 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
|
|
||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
private static final Logger logger = Logger.getLogger(Vector3f.class.getName());
|
private static final Logger logger = Logger.getLogger(Vector3f.class.getName());
|
||||||
|
/**
|
||||||
|
* shared instance of the all-zero vector (0,0,0) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector3f ZERO = new Vector3f(0, 0, 0);
|
public final static Vector3f ZERO = new Vector3f(0, 0, 0);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-NaN vector (NaN,NaN,NaN) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector3f NAN = new Vector3f(Float.NaN, Float.NaN, Float.NaN);
|
public final static Vector3f NAN = new Vector3f(Float.NaN, Float.NaN, Float.NaN);
|
||||||
|
/**
|
||||||
|
* shared instance of the +X direction (1,0,0) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector3f UNIT_X = new Vector3f(1, 0, 0);
|
public final static Vector3f UNIT_X = new Vector3f(1, 0, 0);
|
||||||
|
/**
|
||||||
|
* shared instance of the +Y direction (0,1,0) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector3f UNIT_Y = new Vector3f(0, 1, 0);
|
public final static Vector3f UNIT_Y = new Vector3f(0, 1, 0);
|
||||||
|
/**
|
||||||
|
* shared instance of the +Z direction (0,0,1) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector3f UNIT_Z = new Vector3f(0, 0, 1);
|
public final static Vector3f UNIT_Z = new Vector3f(0, 0, 1);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-ones vector (1,1,1) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector3f UNIT_XYZ = new Vector3f(1, 1, 1);
|
public final static Vector3f UNIT_XYZ = new Vector3f(1, 1, 1);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-plus-infinity vector (+Inf,+Inf,+Inf)
|
||||||
|
* - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector3f POSITIVE_INFINITY = new Vector3f(
|
public final static Vector3f POSITIVE_INFINITY = new Vector3f(
|
||||||
Float.POSITIVE_INFINITY,
|
Float.POSITIVE_INFINITY,
|
||||||
Float.POSITIVE_INFINITY,
|
Float.POSITIVE_INFINITY,
|
||||||
Float.POSITIVE_INFINITY);
|
Float.POSITIVE_INFINITY);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-negative-infinity vector (-Inf,-Inf,-Inf)
|
||||||
|
* - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector3f NEGATIVE_INFINITY = new Vector3f(
|
public final static Vector3f NEGATIVE_INFINITY = new Vector3f(
|
||||||
Float.NEGATIVE_INFINITY,
|
Float.NEGATIVE_INFINITY,
|
||||||
Float.NEGATIVE_INFINITY,
|
Float.NEGATIVE_INFINITY,
|
||||||
@ -917,6 +942,11 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a copy of this vector.
|
||||||
|
*
|
||||||
|
* @return a new instance, equivalent to this one
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Vector3f clone() {
|
public Vector3f clone() {
|
||||||
try {
|
try {
|
||||||
@ -1027,6 +1057,13 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
return "(" + x + ", " + y + ", " + z + ")";
|
return "(" + x + ", " + y + ", " + z + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this vector to the specified exporter, for example when
|
||||||
|
* saving to a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the exporter
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter e) throws IOException {
|
public void write(JmeExporter e) throws IOException {
|
||||||
OutputCapsule capsule = e.getCapsule(this);
|
OutputCapsule capsule = e.getCapsule(this);
|
||||||
@ -1035,6 +1072,13 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
capsule.write(z, "z", 0);
|
capsule.write(z, "z", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize this vector from the specified importer, for example
|
||||||
|
* when loading from a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the importer
|
||||||
|
*/
|
||||||
@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);
|
||||||
@ -1043,28 +1087,61 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
|
|||||||
z = capsule.readFloat("z", 0);
|
z = capsule.readFloat("z", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the X component of this vector.
|
||||||
|
*
|
||||||
|
* @return x
|
||||||
|
*/
|
||||||
public float getX() {
|
public float getX() {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the X component of this vector.
|
||||||
|
*
|
||||||
|
* @param x the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector3f setX(float x) {
|
public Vector3f setX(float x) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the Y component of this vector.
|
||||||
|
*
|
||||||
|
* @return y
|
||||||
|
*/
|
||||||
public float getY() {
|
public float getY() {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the Y component of this vector.
|
||||||
|
*
|
||||||
|
* @param y the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector3f setY(float y) {
|
public Vector3f setY(float y) {
|
||||||
this.y = y;
|
this.y = y;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the Z component of this vector.
|
||||||
|
*
|
||||||
|
* @return z
|
||||||
|
*/
|
||||||
public float getZ() {
|
public float getZ() {
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the Z component of this vector.
|
||||||
|
*
|
||||||
|
* @param z the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector3f setZ(float z) {
|
public Vector3f setZ(float z) {
|
||||||
this.z = z;
|
this.z = z;
|
||||||
return this;
|
return this;
|
||||||
|
@ -48,19 +48,47 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
static final long serialVersionUID = 1;
|
static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(Vector4f.class.getName());
|
private static final Logger logger = Logger.getLogger(Vector4f.class.getName());
|
||||||
|
/**
|
||||||
|
* shared instance of the all-zero vector (0,0,0,0) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f ZERO = new Vector4f(0, 0, 0, 0);
|
public final static Vector4f ZERO = new Vector4f(0, 0, 0, 0);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-NaN vector (NaN,NaN,NaN,NaN) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f NAN = new Vector4f(Float.NaN, Float.NaN, Float.NaN, Float.NaN);
|
public final static Vector4f NAN = new Vector4f(Float.NaN, Float.NaN, Float.NaN, Float.NaN);
|
||||||
|
/**
|
||||||
|
* shared instance of the +X direction (1,0,0,0) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f UNIT_X = new Vector4f(1, 0, 0, 0);
|
public final static Vector4f UNIT_X = new Vector4f(1, 0, 0, 0);
|
||||||
|
/**
|
||||||
|
* shared instance of the +Y direction (0,1,0,0) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f UNIT_Y = new Vector4f(0, 1, 0, 0);
|
public final static Vector4f UNIT_Y = new Vector4f(0, 1, 0, 0);
|
||||||
|
/**
|
||||||
|
* shared instance of the +Z direction (0,0,1,0) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f UNIT_Z = new Vector4f(0, 0, 1, 0);
|
public final static Vector4f UNIT_Z = new Vector4f(0, 0, 1, 0);
|
||||||
|
/**
|
||||||
|
* shared instance of the +W direction (0,0,0,1) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f UNIT_W = new Vector4f(0, 0, 0, 1);
|
public final static Vector4f UNIT_W = new Vector4f(0, 0, 0, 1);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-ones vector (1,1,1,1) - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f UNIT_XYZW = new Vector4f(1, 1, 1, 1);
|
public final static Vector4f UNIT_XYZW = new Vector4f(1, 1, 1, 1);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-plus-infinity vector (+Inf,+Inf,+Inf,+Inf)
|
||||||
|
* - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f POSITIVE_INFINITY = new Vector4f(
|
public final static Vector4f POSITIVE_INFINITY = new Vector4f(
|
||||||
Float.POSITIVE_INFINITY,
|
Float.POSITIVE_INFINITY,
|
||||||
Float.POSITIVE_INFINITY,
|
Float.POSITIVE_INFINITY,
|
||||||
Float.POSITIVE_INFINITY,
|
Float.POSITIVE_INFINITY,
|
||||||
Float.POSITIVE_INFINITY);
|
Float.POSITIVE_INFINITY);
|
||||||
|
/**
|
||||||
|
* shared instance of the all-negative-infinity vector (-Inf,-Inf,-Inf,-Inf)
|
||||||
|
* - Do not modify!
|
||||||
|
*/
|
||||||
public final static Vector4f NEGATIVE_INFINITY = new Vector4f(
|
public final static Vector4f NEGATIVE_INFINITY = new Vector4f(
|
||||||
Float.NEGATIVE_INFINITY,
|
Float.NEGATIVE_INFINITY,
|
||||||
Float.NEGATIVE_INFINITY,
|
Float.NEGATIVE_INFINITY,
|
||||||
@ -824,6 +852,11 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a copy of this vector.
|
||||||
|
*
|
||||||
|
* @return a new instance, equivalent to this one
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Vector4f clone() {
|
public Vector4f clone() {
|
||||||
try {
|
try {
|
||||||
@ -942,6 +975,13 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
return "(" + x + ", " + y + ", " + z + ", " + w + ")";
|
return "(" + x + ", " + y + ", " + z + ", " + w + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize this vector to the specified exporter, for example when
|
||||||
|
* saving to a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the exporter
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(JmeExporter e) throws IOException {
|
public void write(JmeExporter e) throws IOException {
|
||||||
OutputCapsule capsule = e.getCapsule(this);
|
OutputCapsule capsule = e.getCapsule(this);
|
||||||
@ -951,6 +991,13 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
capsule.write(w, "w", 0);
|
capsule.write(w, "w", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-serialize this vector from the specified importer, for example
|
||||||
|
* when loading from a J3O file.
|
||||||
|
*
|
||||||
|
* @param e (not null)
|
||||||
|
* @throws IOException from the importer
|
||||||
|
*/
|
||||||
@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);
|
||||||
@ -960,37 +1007,81 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
|
|||||||
w = capsule.readFloat("w", 0);
|
w = capsule.readFloat("w", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the X component of this vector.
|
||||||
|
*
|
||||||
|
* @return x
|
||||||
|
*/
|
||||||
public float getX() {
|
public float getX() {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the X component of this vector.
|
||||||
|
*
|
||||||
|
* @param x the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector4f setX(float x) {
|
public Vector4f setX(float x) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the Y component of this vector.
|
||||||
|
*
|
||||||
|
* @return y
|
||||||
|
*/
|
||||||
public float getY() {
|
public float getY() {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the Y component of this vector.
|
||||||
|
*
|
||||||
|
* @param y the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector4f setY(float y) {
|
public Vector4f setY(float y) {
|
||||||
this.y = y;
|
this.y = y;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the Z component of this vector.
|
||||||
|
*
|
||||||
|
* @return z
|
||||||
|
*/
|
||||||
public float getZ() {
|
public float getZ() {
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the Z component of this vector.
|
||||||
|
*
|
||||||
|
* @param z the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector4f setZ(float z) {
|
public Vector4f setZ(float z) {
|
||||||
this.z = z;
|
this.z = z;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the W component of this vector.
|
||||||
|
*
|
||||||
|
* @return w
|
||||||
|
*/
|
||||||
public float getW() {
|
public float getW() {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alter the W component of this vector.
|
||||||
|
*
|
||||||
|
* @param w the desired value
|
||||||
|
* @return this vector, modified
|
||||||
|
*/
|
||||||
public Vector4f setW(float w) {
|
public Vector4f setW(float w) {
|
||||||
this.w = w;
|
this.w = w;
|
||||||
return this;
|
return this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user