# Class T3

java.lang.Object
javajs.util.T3

All Implemented Interfaces:
  `Serializable, JSONEncodable`

Direct Known Subclasses:
  `P3, T4, V3`

public abstract class T3 extends Object implements JSONEncodable, Serializable
A generic 3 element tuple that is represented by single precision floating point x,y and z coordinates.

Version:
  specification 1.1, implementation $Revision: 1.10 $, $Date: 2006/09/08 20:20:20 $
Author:
  Kenji hiranabe additions by Bob Hanson hansonr@stolaf.edu 9/30/2012 for unique constructor and method names for the optimization of compiled JavaScript using Java2Script
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`float`
`x`
`float`
`y`
`float`
`z`

## Constructor Summary

Constructors
Constructor
Description
`T3()`

## Method Summary

Modifier and Type
Method
Description
`final void`
`add(T3 t1)`
Sets the value of this tuple to the vector sum of itself and tuple t1.
`final void`
`add2(T3 t1, T3 t2)`
Sets the value of this tuple to the vector sum of tuples t1 and t2.
`final void`
`add3(float a, float b, float c)`
Add {a b c}
`void`
`ave(T3 a, T3 b)`
average of two tuples
`final void`
`cross(T3 v1, T3 v2)`
Sets this tuple to be the vector cross product of vectors v1 and v2.
`final float`
`distance(T3 p1)`
Returns the distance between this point and point p1.
`final float`
`distanceSquared(T3 p1)`
Computes the square of the distance between this point and point p1.
`final float`
`dot(T3 v)`
Vector dot product.
`boolean`
`equals(Object t1)`
Returns true if all of the data members of Tuple3f t1 are equal to the corresponding data members in this
`static int`
`floatToIntBits(float x)`
`int`
`hashCode()`
Returns a hash number based on the data values in this object.
`final float`
`length()`
Returns the length of this vector.
`final float`
`lengthSquared()`
Returns the squared length of this vector.
`final void`
`normalize()`
Normalizes this vector in place.
`T3`
`putP(T3 t)`
`final void`
`scale(float s)`
Sets the value of this tuple to the scalar multiplication of itself.
`final void`
`scaleAdd2(float s, T3 t1, T3 t2)`
Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).
`final void`
`scaleT(T3 p)`
{x*p.x, y*p.y, z*p.z) used for three-way scaling
`final void`
`set(float x, float y, float z)`
Sets the value of this tuple to the specified xyz coordinates.
`final void`
`setA(float[] t)`
Sets the value of this tuple from the 3 values specified in the array.
`T3`
`setP(T3 t)`
`final void`
`setT(T3 t1)`
Sets the value of this tuple to the value of the Tuple3f argument.
`final void`
`sub(T3 t1)`
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).
`final void`
`sub2(T3 t1, T3 t2)`
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).
`String`
`toJSON()`
`String`
`toString()`
Returns a string that contains the values of this Tuple3f.

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### x

public float x

### y

public float y

### z

public float z

## Constructor Details

### T3

public T3()

## Method Details

### set

public final void set(float x, float y, float z)
Sets the value of this tuple to the specified xyz coordinates.

Parameters:
  `x` - the x coordinate
  `y` - the y coordinate
  `z` - the z coordinate

### setA

public final void setA(float[] t)
Sets the value of this tuple from the 3 values specified in the array.

Parameters:
  `t` - the array of length 3 containing xyz in order

### setT

public final void setT(T3 t1)
Sets the value of this tuple to the value of the Tuple3f argument.

Parameters:
  `t1` - the tuple to be copied

### add2

public final void add2(T3 t1, T3 t2)
Sets the value of this tuple to the vector sum of tuples t1 and t2.

Parameters:
  `t1` - the first tuple
  `t2` - the second tuple

### add

public final void add(T3 t1)
Sets the value of this tuple to the vector sum of itself and tuple t1.

Parameters:
  `t1` - the other tuple

### distanceSquared

public final float distanceSquared(T3 p1)
Computes the square of the distance between this point and point p1.

Parameters:
  `p1` - the other point
Returns:
  the square of distance between these two points as a float

### distance

public final float distance(T3 p1)
Returns the distance between this point and point p1.

Parameters:
  `p1` - the other point
Returns:
  the distance between these two points

### sub2

public final void sub2(T3 t1, T3 t2)
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).

Parameters:
  `t1` - the first tuple
  `t2` - the second tuple

### sub

public final void sub(T3 t1)
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).

Parameters:
  `t1` - the other tuple

### scale

public final void scale(float s)
Sets the value of this tuple to the scalar multiplication of itself.

Parameters:
  `s` - the scalar value

### add3

public final void add3(float a, float b, float c)
Add {a b c}

Parameters:
  `a` -
  `b` -
  `c` -

### scaleT

public final void scaleT(T3 p)
{x*p.x, y*p.y, z*p.z) used for three-way scaling

Parameters:
  `p` -

### scaleAdd2

public final void scaleAdd2(float s, T3 t1, T3 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` - the scalar value
  `t1` - the tuple to be multipled
  `t2` - the tuple to be added

### ave

public void ave(T3 a, T3 b)
average of two tuples

Parameters:
  `a` -
  `b` -

### dot

public final float dot(T3 v)
Vector dot product. Was in Vector3f; more useful here, though.

Parameters:
  `v` - the other vector
Returns:
  this.dot.v

### lengthSquared

public final float lengthSquared()
Returns the squared length of this vector. Was in Vector3f; more useful here, though.

Returns:
  the squared length of this vector

### length

public final float length()
Returns the length of this vector. Was in Vector3f; more useful here, though.

Returns:
  the length of this vector

### normalize

public final void normalize()
Normalizes this vector in place. Was in Vector3f; more useful here, though.

### cross

public final void cross(T3 v1, T3 v2)
Sets this tuple to be the vector cross product of vectors v1 and v2.

Parameters:
  `v1` - the first vector
  `v2` - the second vector

### hashCode

public int hashCode()
Returns a hash number based on the data values in this object. Two different Tuple3f objects with identical data values (ie, returns true for equals(Tuple3f) ) will return the same hash number. Two vectors with different data members may return the same hash value, although this is not likely.

Overrides:
  `hashCode` in class `Object`

### floatToIntBits

public static int floatToIntBits(float x)

### equals

public boolean equals(Object t1)
Returns true if all of the data members of Tuple3f t1 are equal to the corresponding data members in this

Overrides:
  `equals` in class `Object`
Parameters:
  `t1` - the vector with which the comparison is made.

### toString

public String toString()
Returns a string that contains the values of this Tuple3f. The form is (x,y,z).

Overrides:
  `toString` in class `Object`
Returns:
  the String representation

### toJSON

public String toJSON()

Specified by:
  `toJSON` in interface `JSONEncodable`

### setP

public T3 setP(T3 t)

### putP

public T3 putP(T3 t)