Package javajs.util
Class T3
java.lang.Object
javajs.util.T3
- All Implemented Interfaces:
Serializable
,JSONEncodable
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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Sets the value of this tuple to the vector sum of itself and tuple t1.final void
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
average of two tuplesfinal void
Sets this tuple to be the vector cross product of vectors v1 and v2.final float
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
Vector dot product.boolean
Returns true if all of the data members of Tuple3f t1 are equal to the corresponding data members in thisstatic 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
Returns the squared length of this vector.final void
Normalizes this vector in place.final void
scale
(float s) Sets the value of this tuple to the scalar multiplication of itself.final void
Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).final void
{x*p.x, y*p.y, z*p.z) used for three-way scalingfinal 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.final void
Sets the value of this tuple to the value of the Tuple3f argument.final void
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).final void
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).toJSON()
toString()
Returns a string that contains the values of this Tuple3f.
-
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 coordinatey
- the y coordinatez
- 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
Sets the value of this tuple to the value of the Tuple3f argument.- Parameters:
t1
- the tuple to be copied
-
add2
Sets the value of this tuple to the vector sum of tuples t1 and t2.- Parameters:
t1
- the first tuplet2
- the second tuple
-
add
Sets the value of this tuple to the vector sum of itself and tuple t1.- Parameters:
t1
- the other tuple
-
distanceSquared
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
Returns the distance between this point and point p1.- Parameters:
p1
- the other point- Returns:
- the distance between these two points
-
sub2
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).- Parameters:
t1
- the first tuplet2
- the second tuple
-
sub
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
{x*p.x, y*p.y, z*p.z) used for three-way scaling- Parameters:
p
-
-
scaleAdd2
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 valuet1
- the tuple to be multipledt2
- the tuple to be added
-
ave
average of two tuples- Parameters:
a
-b
-
-
dot
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
Sets this tuple to be the vector cross product of vectors v1 and v2.- Parameters:
v1
- the first vectorv2
- 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. -
floatToIntBits
public static int floatToIntBits(float x) -
equals
Returns true if all of the data members of Tuple3f t1 are equal to the corresponding data members in this -
toString
Returns a string that contains the values of this Tuple3f. The form is (x,y,z). -
toJSON
- Specified by:
toJSON
in interfaceJSONEncodable
-
setP
-
putP
-