Package javax.vecmath
Class Tuple3b
java.lang.Object
javax.vecmath.Tuple3b
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
Color3b
A three byte tuple. Note that Java defines a byte as a signed integer
in the range [-128, 127]. However, colors are more typically
represented by values in the range [0, 255]. Java 3D recognizes this
and, in those cases where Tuple3b is used to represent color, treats
the bytes as if the range were [0, 255]---in other words, as if the
bytes were unsigned.
Values greater than 127 can be assigned to a byte variable using a
type cast. For example:
byteVariable = (byte) intValue; // intValue can be > 127
If intValue is greater than 127, then byteVariable will be negative. The
correct value will be extracted when it is used (by masking off the upper
bits).- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTuple3b()
Constructs and initializes a Tuple3b to (0,0,0).Tuple3b
(byte[] t) Constructs and initializes a Tuple3b from input array of length 3.Tuple3b
(byte b1, byte b2, byte b3) Constructs and initializes a Tuple3b from the specified three values.Constructs and initializes a Tuple3b from the specified Tuple3b. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a new object of the same class as this object.boolean
Returns true if the Object t1 is of type Tuple3b and all of the data members of t1 are equal to the corresponding data members in this Tuple3b.boolean
Returns true if all of the data members of tuple t1 are equal to the corresponding data members in this tuple.final void
get
(byte[] t) Places the value of the x,y,z components of this Tuple3b into the array of length 3.final void
Places the value of the x,y,z components of this tuple into the tuple t1.final byte
getX()
Get x, the first value.final byte
getY()
Get y, the second value.final byte
getZ()
Get z, the third value.int
hashCode()
Returns a hash code value based on the data values in this object.final void
set
(byte[] t) Sets the value of the x,y,z, data members of this tuple to the values in the array t of length 3.final void
Sets the value of the data members of this tuple to the value of the argument tuple t1.final void
setX
(byte x) Set x, the first value.final void
setY
(byte y) Set y, the second value.final void
setZ
(byte z) Set z, the third value.toString()
Returns a string that contains the values of this Tuple3b.
-
Field Details
-
x
public byte xThe first value. -
y
public byte yThe second value. -
z
public byte zThe third value.
-
-
Constructor Details
-
Tuple3b
public Tuple3b(byte b1, byte b2, byte b3) Constructs and initializes a Tuple3b from the specified three values.- Parameters:
b1
- the first valueb2
- the second valueb3
- the third value
-
Tuple3b
public Tuple3b(byte[] t) Constructs and initializes a Tuple3b from input array of length 3.- Parameters:
t
- the array of length 3 containing b1 b2 b3 in order
-
Tuple3b
Constructs and initializes a Tuple3b from the specified Tuple3b.- Parameters:
t1
- the Tuple3b containing the initialization x y z data
-
Tuple3b
public Tuple3b()Constructs and initializes a Tuple3b to (0,0,0).
-
-
Method Details
-
toString
Returns a string that contains the values of this Tuple3b. -
get
public final void get(byte[] t) Places the value of the x,y,z components of this Tuple3b into the array of length 3.- Parameters:
t
- array of length 3 into which the component values are copied
-
get
Places the value of the x,y,z components of this tuple into the tuple t1.- Parameters:
t1
- the tuple into which the values are placed
-
set
Sets the value of the data members of this tuple to the value of the argument tuple t1.- Parameters:
t1
- the source tuple for the memberwise copy
-
set
public final void set(byte[] t) Sets the value of the x,y,z, data members of this tuple to the values in the array t of length 3.- Parameters:
t
- array of length 3 which is the source for the memberwise copy
-
equals
Returns true if all of the data members of tuple t1 are equal to the corresponding data members in this tuple.- Parameters:
t1
- the tuple with which the comparison is made- Returns:
- true or false
-
equals
Returns true if the Object t1 is of type Tuple3b and all of the data members of t1 are equal to the corresponding data members in this Tuple3b. -
hashCode
public int hashCode()Returns a hash code value based on the data values in this object. Two different Tuple3b objects with identical data values (i.e., Tuple3b.equals returns true) will return the same hash code value. Two objects with different data members may return the same hash value, although this is not likely. -
clone
Creates a new object of the same class as this object.- Overrides:
clone
in classObject
- Returns:
- a clone of this instance.
- Throws:
OutOfMemoryError
- if there is not enough memory.- Since:
- vecmath 1.3
- See Also:
-
getX
public final byte getX()Get x, the first value.- Returns:
- the first value.
- Since:
- vecmath 1.5
-
setX
public final void setX(byte x) Set x, the first value.- Parameters:
x
- the first value to set.- Since:
- vecmath 1.5
-
getY
public final byte getY()Get y, the second value.- Returns:
- the second value.
- Since:
- vecmath 1.5
-
setY
public final void setY(byte y) Set y, the second value.- Parameters:
y
- the second value to set.- Since:
- vecmath 1.5
-
getZ
public final byte getZ()Get z, the third value.- Returns:
- the third value.
- Since:
- vecmath 1.5
-
setZ
public final void setZ(byte z) Set z, the third value.- Parameters:
z
- the third value to set.- Since:
- vecmath 1.5
-