View Javadoc

1   package com.insanityengine.ghia.m3;
2   
3   import com.insanityengine.ghia.libograf.State;
4   
5   /***
6    *
7    * <P>
8    * </P>
9    *
10   * @author BrianHammond
11   *
12   * $Header: /usr/local/cvsroot/ghia/src/java/com/insanityengine/ghia/m3/Matrix.java,v 1.3 2005/03/19 17:50:02 brian Exp $
13   *
14   */
15  
16  public class Matrix extends Mat4 implements State {
17  	
18  	/*** 
19  	 * 
20  	 * Constructor
21  	 * 
22  	 */
23  	public Matrix() { 
24  		super();
25  		ws1 = new Mat4();
26  		ws2 = new Mat4();
27  	}
28  	
29  	/*** 
30  	 * 
31  	 * Constructor
32  	 * 
33  	 * @param d
34  	 * 
35  	 */
36  	public Matrix( float d ) { 
37  		super( d );
38  		ws1 = new Mat4();
39  		ws2 = new Mat4();
40  	}
41  	
42  	/*** 
43  	 * 
44  	 * Constructor
45  	 * 
46  	 * @param that
47  	 * 
48  	 */
49  	public Matrix( Matrix that ) {
50  		super.set( that );
51  	}
52  
53  	/***
54  	 *
55  	 * State interface:
56  	 *
57  	 */
58  
59  	/*** 
60  	 * 
61  	 * identity
62  	 * 
63  	 * @return a State
64  	 * 
65  	 */
66  	public State identity() {
67  		super.loadIdentity();
68  		return this;
69  	}
70  	
71  	/*** 
72  	 * 
73  	 * rotate
74  	 *
75  	 * @param angle
76  	 * @param workspace1
77  	 * @param workspace2
78  	 * 
79  	 * @return a State
80  	 * 
81  	 */
82  	public State rotate( Pt3 angle ) {
83  		super.rotate( angle, ws1, ws2 );
84  		return this;
85  	}
86  	
87  	/*** 
88  	 * 
89  	 * translate
90  	 * 
91  	 * @param displacement
92  	 * @param workspace1
93  	 * @param workspace2
94  	 * 
95  	 * @return a State
96  	 * 
97  	 */
98  	public State translate( Pt3 displacement ) {
99  		super.translate( displacement, ws1, ws2 );
100 		return this;
101 	}
102 	
103 	/*** 
104 	 * 
105 	 * scale
106 	 * 
107 	 * @param ratio
108 	 * @param workspace1
109 	 * @param workspace2
110 	 * 
111 	 * @return a State
112 	 * 
113 	 */
114 	public State scale( Pt3 ratio ) {
115 		super.scale( ratio, ws1, ws2 );
116 		return this;
117 	}
118 	
119 	/*** 
120 	 * 
121 	 * multiply
122 	 * 
123 	 * @param state
124 	 * 
125 	 * @return a State
126 	 * 
127 	 */
128 	public State multiply( State state ) {
129 		ws1.set( this );
130 		super.multiply( ws1.set( this ), ( Mat4 ) state );
131 		return this;
132 	}
133 
134 	/*** 
135 	 * 
136 	 * set
137 	 * 
138 	 * @param state
139 	 * 
140 	 * @return this State
141 	 * 
142 	 */
143 	public State set( State state ) {
144 		super.set( ( Mat4 ) state );
145 		return this;
146 	}
147 
148 	/*** 
149 	 * 
150 	 * multiply
151 	 * 
152 	 * @param point
153 	 * @param destination
154 	 * 
155 	 * @return a Pt3
156 	 * 
157 	 */
158 	//public Pt3 multiply( Pt3 point, Pt3 destination );
159 
160 	/***
161 	 *
162 	 * This should not be available outside the object...
163 	 *
164 	 */
165 	private Mat4 ws1;
166 	private Mat4 ws2;
167 
168 };
169 
170 /***
171  *
172  * $Log: Matrix.java,v $
173  * Revision 1.3  2005/03/19 17:50:02  brian
174  * repackaging
175  *
176  * Revision 1.2  2005/03/12 04:58:47  brian
177  * call the methods set instead of copy
178  *
179  * Revision 1.1  2005/03/11 23:36:37  brian
180  * wraps Mat4 and adds workspace support
181  *
182  *
183  */