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 3-element tuple represented by signed integer x,y,z coordinates.
23 * @version specification 1.2, 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 for unique
28 * constructor and method names for the optimization of compiled
29 * JavaScript using Java2Script.
32 public abstract class T3i {
50 * Constructs and initializes a Tuple3i to (0,0,0).
56 * Sets the value of this tuple to to the specified x, y, and z coordinates.
65 public final void set(int x, int y, int z) {
72 * Sets the value of this tuple to the value of tuple t1.
75 * the tuple to be copied.
77 public final void setT(T3i t1) {
84 * Sets the value of this tuple to the sum of itself and t1.
89 public final void add(T3i t) {
96 * Sets the value of this tuple to the scalar multiplication of tuple t1 plus
97 * tuple t2 (this = s*t1 + t2).
102 * the tuple to be multipled
104 * the tuple to be added
106 public final void scaleAdd(int s, T3i t1, T3i t2) {
113 * Returns a hash number based on the data values in this object. Two
114 * different Tuple3i objects with identical data values (ie, returns true for
115 * equals(Tuple3i) ) will return the same hash number. Two vectors with
116 * different data members may return the same hash value, although this is not
120 public int hashCode() {
125 * Returns true if the Object o is of type Tuple3i and all of the data members
126 * of t are equal to the corresponding data members in this Tuple3i.
129 * the object with which the comparison is made.
132 public boolean equals(Object o) {
133 if (!(o instanceof T3i))
136 return (this.x == t.x && this.y == t.y && this.z == t.z);
140 * Returns a string that contains the values of this Tuple3i. The form is
143 * @return the String representation
146 public String toString() {
147 return "(" + x + ", " + y + ", " + z + ")";