001    /*
002    *
003    
004    Licensed under the Apache License, Version 2.0 (the "License");
005    you may not use this file except in compliance with the License.
006    You may obtain a copy of the License at
007    
008       http://www.apache.org/licenses/LICENSE-2.0
009    
010    Unless required by applicable law or agreed to in writing, software
011    distributed under the License is distributed on an "AS IS" BASIS,
012    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013    See the License for the specific language governing permissions and
014    limitations under the License.
015    */
016    
017    package railo.runtime.img.vecmath;
018    
019    /**
020     * Vector math package, converted to look similar to javax.vecmath.
021     */
022    public class AxisAngle4f {
023            public float x, y, z, angle;
024    
025            public AxisAngle4f() {
026                    this( 0, 0, 0, 0 );
027            }
028            
029            public AxisAngle4f( float[] x ) {
030                    this.x = x[0];
031                    this.y = x[1];
032                    this.z = x[2];
033                    this.angle = x[2];
034            }
035    
036            public AxisAngle4f( float x, float y, float z, float angle ) {
037                    this.x = x;
038                    this.y = y;
039                    this.z = z;
040                    this.angle = angle;
041            }
042    
043            public AxisAngle4f( AxisAngle4f t ) {
044                    this.x = t.x;
045                    this.y = t.y;
046                    this.z = t.z;
047                    this.angle = t.angle;
048            }
049    
050            public AxisAngle4f( Vector3f v, float angle ) {
051                    this.x = v.x;
052                    this.y = v.y;
053                    this.z = v.z;
054                    this.angle = angle;
055            }
056    
057            public void set( float x, float y, float z, float angle ) {
058                    this.x = x;
059                    this.y = y;
060                    this.z = z;
061                    this.angle = angle;
062            }
063    
064            public void set( AxisAngle4f t ) {
065                    x = t.x;
066                    y = t.y;
067                    z = t.z;
068                    angle = t.angle;
069            }
070    
071            public void get( AxisAngle4f t ) {
072                    t.x = x;
073                    t.y = y;
074                    t.z = z;
075                    t.angle = angle;
076            }
077    
078            public void get( float[] t ) {
079                    t[0] = x;
080                    t[1] = y;
081                    t[2] = z;
082                    t[3] = angle;
083            }
084    
085            public String toString() {
086                    return "["+x+", "+y+", "+z+", "+angle+"]";
087            }
088            
089    }