Package jme3utilities.math
Class Vector3i
java.lang.Object
jme3utilities.math.Vector3i
- All Implemented Interfaces:
com.jme3.export.Savable
Integer vector with 3 components, used to identify a chunk in a 3-D world or
represent the offset between 2 chunks. Immutable except for
read(com.jme3.export.JmeImporter).-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(int deltaX, int deltaY, int deltaZ) Add to (translate) the current instance.booleanTest for exact equivalence with another Object.inthashCode()Generate the hash code for this vector.voidread(com.jme3.export.JmeImporter importer) De-serialize this vector, for example when loading from a J3O file.subtract(int deltaX, int deltaY, int deltaZ) Subtract from (inverse translate) the current instance.toString()Represent this vector as a text string.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this vector, for example when saving to a J3O file.intx()Determine the X component.intCompare the X component to that of another vector.inty()Determine the Y component.intCompare the Y component to that of another chunk.intz()Determine the Z component.intCompare the Z component to that of another chunk.
-
Field Details
-
zero
instance with all components =0 -
logger
message logger for this class
-
-
Constructor Details
-
Vector3i
protected Vector3i()No-argument constructor needed by SavableClassUtil. -
Vector3i
public Vector3i(int x, int y, int z) Instantiate a vector.- Parameters:
x- the desired X componenty- the desired Y componentz- the desired Z component
-
-
Method Details
-
add
Add to (translate) the current instance.- Parameters:
deltaX- the number of units in the +X directiondeltaY- the number of units in the +Y directiondeltaZ- the number of units in the +Z direction- Returns:
- a new vector
-
subtract
Subtract from (inverse translate) the current instance.- Parameters:
deltaX- the number of units in the -X directiondeltaY- the number of units in the -Y directiondeltaZ- the number of units in the -Z direction- Returns:
- a new vector
-
x
public int x()Determine the X component.- Returns:
- the component value
-
xDiff
Compare the X component to that of another vector.- Parameters:
other- (not null)- Returns:
- the difference (
thisminusother)
-
y
public int y()Determine the Y component.- Returns:
- the component value
-
yDiff
Compare the Y component to that of another chunk.- Parameters:
other- (not null)- Returns:
- the difference (
thisminusother)
-
z
public int z()Determine the Z component.- Returns:
- the component value
-
zDiff
Compare the Z component to that of another chunk.- Parameters:
other- (not null)- Returns:
- the difference (
thisminusother)
-
equals
Test for exact equivalence with another Object. -
hashCode
public int hashCode()Generate the hash code for this vector. -
toString
Represent this vector as a text string. The format is: (X,Y,Z) -
read
De-serialize this vector, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Parameters:
importer- (not null)- Throws:
IOException- from importer
-
write
Serialize this vector, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Parameters:
exporter- (not null)- Throws:
IOException- from exporter
-