2 Copyright (C) 1997,1998,1999
3 Kenji Hiranabe, Eiwa System Management, Inc.
5 This program is free software.
6 Implemented by Kenji Hiranabe(hiranabe@esm.co.jp),
7 conforming to the Java(TM) 3D API specification by Sun Microsystems.
9 Permission to use, copy, modify, distribute and sell this software
10 and its documentation for any purpose is hereby granted without fee,
11 provided that the above copyright notice appear in all copies and
12 that both that copyright notice and this permission notice appear
13 in supporting documentation. Kenji Hiranabe and Eiwa System Management,Inc.
14 makes no representations about the suitability of this software for any
15 purpose. It is provided "AS IS" with NO WARRANTY.
20 * A generic 4 element tuple that is represented by single precision floating
21 * point x,y,z and w coordinates.
23 * @version specification 1.1, implementation $Revision: 1.9 $, $Date:
24 * 2006/07/28 17:01:32 $
25 * @author Kenji hiranabe
27 * additions by Bob Hanson hansonr@stolaf.edu 9/30/2012
28 * for unique constructor and method names
29 * for the optimization of compiled JavaScript using Java2Script.
32 public abstract class T4 extends T3 {
40 * Sets the value of this tuple to the specified xyzw coordinates.
51 public final void set4(float x, float y, float z, float w) {
59 * Sets the value of this tuple to the scalar multiplication of itself.
64 public final void scale4(float s) {
70 * Returns a hash number based on the data values in this object. Two
71 * different Tuple4f objects with identical data values (ie, returns true for
72 * equals(Tuple4f) ) will return the same hash number. Two vectors with
73 * different data members may return the same hash value, although this is not
77 public int hashCode() {
78 return T3.floatToIntBits(x) ^ T3.floatToIntBits(y)
79 ^ T3.floatToIntBits(z) ^ T3.floatToIntBits(w);
83 * Returns true if all of the data members of Object are equal to the
84 * corresponding data members in this
87 * the vector with which the comparison is made.
90 public boolean equals(Object o) {
91 if (!(o instanceof T4))
94 return (this.x == t.x && this.y == t.y && this.z == t.z && this.w == t.w);
98 * Returns a string that contains the values of this Tuple4f. The form is
101 * @return the String representation
104 public String toString() {
105 return "(" + x + ", " + y + ", " + z + ", " + w + ")";
109 public String toJSON() {
110 return "[" + x + ", " + y + ", " + z + ", " + w + "]";