2 Copyright (C) 1997,1998,1999
\r
3 Kenji Hiranabe, Eiwa System Management, Inc.
\r
5 This program is free software.
\r
6 Implemented by Kenji Hiranabe(hiranabe@esm.co.jp),
\r
7 conforming to the Java(TM) 3D API specification by Sun Microsystems.
\r
9 Permission to use, copy, modify, distribute and sell this software
\r
10 and its documentation for any purpose is hereby granted without fee,
\r
11 provided that the above copyright notice appear in all copies and
\r
12 that both that copyright notice and this permission notice appear
\r
13 in supporting documentation. Kenji Hiranabe and Eiwa System Management,Inc.
\r
14 makes no representations about the suitability of this software for any
\r
15 purpose. It is provided "AS IS" with NO WARRANTY.
\r
17 package javajs.util;
\r
19 import java.io.Serializable;
\r
22 * A 3-element tuple represented by signed integer x,y,z coordinates.
\r
24 * @since Java 3D 1.2
\r
25 * @version specification 1.2, implementation $Revision: 1.9 $, $Date:
\r
26 * 2006/07/28 17:01:32 $
\r
27 * @author Kenji hiranabe
\r
29 * additions by Bob Hanson hansonr@stolaf.edu 9/30/2012 for unique
\r
30 * constructor and method names for the optimization of compiled
\r
31 * JavaScript using Java2Script
\r
33 public abstract class T3i implements Serializable {
\r
51 * Constructs and initializes a Tuple3i to (0,0,0).
\r
57 * Sets the value of this tuple to to the specified x, y, and z coordinates.
\r
66 public final void set(int x, int y, int z) {
\r
73 * Sets the value of this tuple to the value of tuple t1.
\r
76 * the tuple to be copied.
\r
78 public final void setT(T3i t1) {
\r
85 * Sets the value of this tuple to the sum of itself and t1.
\r
88 * is the other tuple
\r
90 public final void add(T3i t) {
\r
97 * Sets the value of this tuple to the scalar multiplication of tuple t1 plus
\r
98 * tuple t2 (this = s*t1 + t2).
\r
103 * the tuple to be multipled
\r
105 * the tuple to be added
\r
107 public final void scaleAdd(int s, T3i t1, T3i t2) {
\r
108 x = s * t1.x + t2.x;
\r
109 y = s * t1.y + t2.y;
\r
110 z = s * t1.z + t2.z;
\r
114 * Returns a hash number based on the data values in this object. Two
\r
115 * different Tuple3i objects with identical data values (ie, returns true for
\r
116 * equals(Tuple3i) ) will return the same hash number. Two vectors with
\r
117 * different data members may return the same hash value, although this is not
\r
121 public int hashCode() {
\r
126 * Returns true if the Object o is of type Tuple3i and all of the data members
\r
127 * of t are equal to the corresponding data members in this Tuple3i.
\r
130 * the object with which the comparison is made.
\r
133 public boolean equals(Object o) {
\r
134 if (!(o instanceof T3i))
\r
137 return (this.x == t.x && this.y == t.y && this.z == t.z);
\r
141 * Returns a string that contains the values of this Tuple3i. The form is
\r
144 * @return the String representation
\r
147 public String toString() {
\r
148 return "(" + x + ", " + y + ", " + z + ")";
\r