Top Description Fields Constructors Methods
javax.vecmath

public abstract Class Tuple2f

extends Object
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Known Direct Subclasses
javax.vecmath.Vector2f, javax.vecmath.Point2f, javax.vecmath.TexCoord2f
Imports
java.lang.Math

A generic 2-element tuple that is represented by single-precision floating point x,y coordinates.

Field Summary

Modifier and TypeField and Description
pack-priv static final long
public float
x

The x coordinate.

public float
y

The y coordinate.

Constructor Summary

AccessConstructor and Description
public
Tuple2f(float
the x coordinate
x
,
float
the y coordinate
y
)

Constructs and initializes a Tuple2f from the specified xy coordinates.

public
Tuple2f(float[]
the array of length 2 containing xy in order
t
)

Constructs and initializes a Tuple2f from the specified array.

public
Tuple2f(Tuple2f
the Tuple2f containing the initialization x y data
t1
)

Constructs and initializes a Tuple2f from the specified Tuple2f.

public
Tuple2f(Tuple2d
the Tuple2d containing the initialization x y data
t1
)

Constructs and initializes a Tuple2f from the specified Tuple2d.

public
Tuple2f()

Constructs and initializes a Tuple2f to (0,0).

Method Summary

Modifier and TypeMethod and Description
public final void
absolute(Tuple2f
the source tuple, which will not be modified
t
)

Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.

public final void
absolute()

Sets each component of this tuple to its absolute value.

public final void
add(Tuple2f
the first tuple
t1
,
Tuple2f
the second tuple
t2
)

Sets the value of this tuple to the vector sum of tuples t1 and t2.

public final void
add(Tuple2f
the other tuple
t1
)

Sets the value of this tuple to the vector sum of itself and tuple t1.

public final void
clamp(float
the lowest value in the tuple after clamping
min
,
float
the highest value in the tuple after clamping
max
,
Tuple2f
the source tuple, which will not be modified
t
)

Clamps the tuple parameter to the range [low, high] and places the values into this tuple.

public final void
clamp(float
the lowest value in this tuple after clamping
min
,
float
the highest value in this tuple after clamping
max
)

Clamps this tuple to the range [low, high].

public final void
clampMax(float
the highest value in the tuple after clamping
max
,
Tuple2f
the source tuple, which will not be modified
t
)

Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple.

public final void
clampMax(float
the highest value in the tuple after clamping
max
)

Clamps the maximum value of this tuple to the max parameter.

public final void
clampMin(float
the lowest value in the tuple after clamping
min
,
Tuple2f
the source tuple, which will not be modified
t
)

Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple.

public final void
clampMin(float
the lowest value in this tuple after clamping
min
)

Clamps the minimum value of this tuple to the min parameter.

public Object

Returns:

a clone of this instance.
clone
()

Overrides java.lang.Object.clone.

Creates a new object of the same class as this object.
public boolean

Returns:

true or false
epsilonEquals
(Tuple2f
the tuple to be compared to this tuple
t1
,
float
the threshold value
epsilon
)

Returns true if the L-infinite distance between this tuple and tuple t1 is less than or equal to the epsilon parameter, otherwise returns false.

public boolean

Returns:

true or false
equals
(Tuple2f
the vector with which the comparison is made
t1
)

Returns true if all of the data members of Tuple2f t1 are equal to the corresponding data members in this Tuple2f.

public boolean

Returns:

true or false
equals
(Object
the object with which the comparison is made
t1
)

Overrides java.lang.Object.equals.

Returns true if the Object t1 is of type Tuple2f and all of the data members of t1 are equal to the corresponding data members in this Tuple2f.
public final void
get(float[]
the array that will contain the values of the vector
t
)

Copies the value of the elements of this tuple into the array t.

public final float

Returns:

the x coordinate.
getX
()

Get the x coordinate.

public final float

Returns:

the y coordinate.
getY
()

Get the y coordinate.

public int

Returns:

the integer hash code value
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value based on the data values in this object.
public final void
interpolate(Tuple2f
the first tuple
t1
,
Tuple2f
the second tuple
t2
,
float
the alpha interpolation parameter
alpha
)

Linearly interpolates between tuples t1 and t2 and places the result into this tuple: this = (1-alpha)*t1 + alpha*t2.

public final void
interpolate(Tuple2f
the first tuple
t1
,
float
the alpha interpolation parameter
alpha
)

Linearly interpolates between this tuple and tuple t1 and places the result into this tuple: this = (1-alpha)*this + alpha*t1.

public final void
negate(Tuple2f
the source tuple
t1
)

Sets the value of this tuple to the negation of tuple t1.

public final void
negate()

Negates the value of this vector in place.

public final void
scale(float
the scalar value
s
,
Tuple2f
the source tuple
t1
)

Sets the value of this tuple to the scalar multiplication of tuple t1.

public final void
scale(float
the scalar value
s
)

Sets the value of this tuple to the scalar multiplication of itself.

public final void
scaleAdd(float
the scalar value
s
,
Tuple2f
the tuple to be multipled
t1
,
Tuple2f
the tuple to be added
t2
)

Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).

public final void
scaleAdd(float
the scalar value
s
,
Tuple2f
the tuple to be added
t1
)

Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1).

public final void
set(float
the x coordinate
x
,
float
the y coordinate
y
)

Sets the value of this tuple to the specified xy coordinates.

public final void
set(float[]
the array of length 2 containing xy in order
t
)

Sets the value of this tuple from the 2 values specified in the array.

public final void
set(Tuple2f
the tuple to be copied
t1
)

Sets the value of this tuple to the value of the Tuple2f argument.

public final void
set(Tuple2d
the tuple to be copied
t1
)

Sets the value of this tuple to the value of the Tuple2d argument.

public final void
setX(float
value to x coordinate.
x
)

Set the x coordinate.

public final void
setY(float
value to y coordinate.
y
)

Set the y coordinate.

public final void
sub(Tuple2f
the first tuple
t1
,
Tuple2f
the second tuple
t2
)

Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).

public final void
sub(Tuple2f
the other tuple
t1
)

Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).

public String

Returns:

the String representation
toString
()

Overrides java.lang.Object.toString.

Returns a string that contains the values of this Tuple2f.
Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID
xback to summary
public float x

The x coordinate.

yback to summary
public float y

The y coordinate.

Constructor Detail

Tuple2fback to summary
public Tuple2f(float x, float y)

Constructs and initializes a Tuple2f from the specified xy coordinates.

Parameters
x:float

the x coordinate

y:float

the y coordinate

Tuple2fback to summary
public Tuple2f(float[] t)

Constructs and initializes a Tuple2f from the specified array.

Parameters
t:float[]

the array of length 2 containing xy in order

Tuple2fback to summary
public Tuple2f(Tuple2f t1)

Constructs and initializes a Tuple2f from the specified Tuple2f.

Parameters
t1:Tuple2f

the Tuple2f containing the initialization x y data

Tuple2fback to summary
public Tuple2f(Tuple2d t1)

Constructs and initializes a Tuple2f from the specified Tuple2d.

Parameters
t1:Tuple2d

the Tuple2d containing the initialization x y data

Tuple2fback to summary
public Tuple2f()

Constructs and initializes a Tuple2f to (0,0).

Method Detail

absoluteback to summary
public final void absolute(Tuple2f t)

Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.

Parameters
t:Tuple2f

the source tuple, which will not be modified

absoluteback to summary
public final void absolute()

Sets each component of this tuple to its absolute value.

addback to summary
public final void add(Tuple2f t1, Tuple2f t2)

Sets the value of this tuple to the vector sum of tuples t1 and t2.

Parameters
t1:Tuple2f

the first tuple

t2:Tuple2f

the second tuple

addback to summary
public final void add(Tuple2f t1)

Sets the value of this tuple to the vector sum of itself and tuple t1.

Parameters
t1:Tuple2f

the other tuple

clampback to summary
public final void clamp(float min, float max, Tuple2f t)

Clamps the tuple parameter to the range [low, high] and places the values into this tuple.

Parameters
min:float

the lowest value in the tuple after clamping

max:float

the highest value in the tuple after clamping

t:Tuple2f

the source tuple, which will not be modified

clampback to summary
public final void clamp(float min, float max)

Clamps this tuple to the range [low, high].

Parameters
min:float

the lowest value in this tuple after clamping

max:float

the highest value in this tuple after clamping

clampMaxback to summary
public final void clampMax(float max, Tuple2f t)

Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple.

Parameters
max:float

the highest value in the tuple after clamping

t:Tuple2f

the source tuple, which will not be modified

clampMaxback to summary
public final void clampMax(float max)

Clamps the maximum value of this tuple to the max parameter.

Parameters
max:float

the highest value in the tuple after clamping

clampMinback to summary
public final void clampMin(float min, Tuple2f t)

Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple.

Parameters
min:float

the lowest value in the tuple after clamping

t:Tuple2f

the source tuple, which will not be modified

clampMinback to summary
public final void clampMin(float min)

Clamps the minimum value of this tuple to the min parameter.

Parameters
min:float

the lowest value in this tuple after clamping

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Creates a new object of the same class as this object.

Returns:Object

a clone of this instance.

Exceptions
OutOfMemoryError:
if there is not enough memory.
Since
vecmath 1.3
See Also
java.lang.Cloneable
epsilonEqualsback to summary
public boolean epsilonEquals(Tuple2f t1, float epsilon)

Returns true if the L-infinite distance between this tuple and tuple t1 is less than or equal to the epsilon parameter, otherwise returns false. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].

Parameters
t1:Tuple2f

the tuple to be compared to this tuple

epsilon:float

the threshold value

Returns:boolean

true or false

equalsback to summary
public boolean equals(Tuple2f t1)

Returns true if all of the data members of Tuple2f t1 are equal to the corresponding data members in this Tuple2f.

Parameters
t1:Tuple2f

the vector with which the comparison is made

Returns:boolean

true or false

equalsback to summary
public boolean equals(Object t1)

Overrides java.lang.Object.equals.

Returns true if the Object t1 is of type Tuple2f and all of the data members of t1 are equal to the corresponding data members in this Tuple2f.

Parameters
t1:Object

the object with which the comparison is made

Returns:boolean

true or false

getback to summary
public final void get(float[] t)

Copies the value of the elements of this tuple into the array t.

Parameters
t:float[]

the array that will contain the values of the vector

getXback to summary
public final float getX()

Get the x coordinate.

Returns:float

the x coordinate.

Since
vecmath 1.5
getYback to summary
public final float getY()

Get the y coordinate.

Returns:float

the y coordinate.

Since
vecmath 1.5
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value based on the data values in this object. Two different Tuple2f objects with identical data values (i.e., Tuple2f.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.

Returns:int

the integer hash code value

interpolateback to summary
public final void interpolate(Tuple2f t1, Tuple2f t2, float alpha)

Linearly interpolates between tuples t1 and t2 and places the result into this tuple: this = (1-alpha)*t1 + alpha*t2.

Parameters
t1:Tuple2f

the first tuple

t2:Tuple2f

the second tuple

alpha:float

the alpha interpolation parameter

interpolateback to summary
public final void interpolate(Tuple2f t1, float alpha)

Linearly interpolates between this tuple and tuple t1 and places the result into this tuple: this = (1-alpha)*this + alpha*t1.

Parameters
t1:Tuple2f

the first tuple

alpha:float

the alpha interpolation parameter

negateback to summary
public final void negate(Tuple2f t1)

Sets the value of this tuple to the negation of tuple t1.

Parameters
t1:Tuple2f

the source tuple

negateback to summary
public final void negate()

Negates the value of this vector in place.

scaleback to summary
public final void scale(float s, Tuple2f t1)

Sets the value of this tuple to the scalar multiplication of tuple t1.

Parameters
s:float

the scalar value

t1:Tuple2f

the source tuple

scaleback to summary
public final void scale(float s)

Sets the value of this tuple to the scalar multiplication of itself.

Parameters
s:float

the scalar value

scaleAddback to summary
public final void scaleAdd(float s, Tuple2f t1, Tuple2f t2)

Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).

Parameters
s:float

the scalar value

t1:Tuple2f

the tuple to be multipled

t2:Tuple2f

the tuple to be added

scaleAddback to summary
public final void scaleAdd(float s, Tuple2f t1)

Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1).

Parameters
s:float

the scalar value

t1:Tuple2f

the tuple to be added

setback to summary
public final void set(float x, float y)

Sets the value of this tuple to the specified xy coordinates.

Parameters
x:float

the x coordinate

y:float

the y coordinate

setback to summary
public final void set(float[] t)

Sets the value of this tuple from the 2 values specified in the array.

Parameters
t:float[]

the array of length 2 containing xy in order

setback to summary
public final void set(Tuple2f t1)

Sets the value of this tuple to the value of the Tuple2f argument.

Parameters
t1:Tuple2f

the tuple to be copied

setback to summary
public final void set(Tuple2d t1)

Sets the value of this tuple to the value of the Tuple2d argument.

Parameters
t1:Tuple2d

the tuple to be copied

setXback to summary
public final void setX(float x)

Set the x coordinate.

Parameters
x:float

value to x coordinate.

Since
vecmath 1.5
setYback to summary
public final void setY(float y)

Set the y coordinate.

Parameters
y:float

value to y coordinate.

Since
vecmath 1.5
subback to summary
public final void sub(Tuple2f t1, Tuple2f t2)

Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).

Parameters
t1:Tuple2f

the first tuple

t2:Tuple2f

the second tuple

subback to summary
public final void sub(Tuple2f t1)

Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).

Parameters
t1:Tuple2f

the other tuple

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string that contains the values of this Tuple2f. The form is (x,y).

Returns:String

the String representation