new benchmark -- fluidanimate for Scheduling
[IRC.git] / Robust / src / Benchmarks / Scheduling / PSFluidAnimate / Vec3.java
1 public class Vec3 {
2     public float m_x;
3     public float m_y;
4     public float m_z;
5
6     public Vec3() {
7     }
8     
9     public Vec3(float _x, float _y, float _z) {
10         this.m_x = _x;
11         this.m_y = _y;
12         this.m_z = _z;
13     }
14
15     public float GetLengthSq() { 
16         return this.m_x*this.m_x + this.m_y*this.m_y + this.m_z*this.m_z; 
17     }
18     
19     public float GetLength() {
20         return Math.sqrtf(GetLengthSq());
21     }
22     
23     void Normalize() {
24         this.m_x /= GetLength();
25         this.m_y /= GetLength();
26         this.m_z /= GetLength();
27     }
28
29     void add0(Vec3 v) { 
30         this.m_x += v.m_x;  
31         this.m_y += v.m_y; 
32         this.m_z += v.m_z; 
33     }
34     
35     void sub0(Vec3 v) { 
36         this.m_x -= v.m_x;  
37         this.m_y -= v.m_y; 
38         this.m_z -= v.m_z; 
39     }
40     
41     void mul0(float s) { 
42         this.m_x *= s;  
43         this.m_y *= s; 
44         this.m_z *= s; 
45     }
46     
47     void div0(float s) { 
48         this.m_x /= s;  
49         this.m_y /= s; 
50         this.m_z /= s; 
51     }
52
53     Vec3 add1(Vec3 v) { 
54         return new Vec3(this.m_x+v.m_x, this.m_y+v.m_y, this.m_z+v.m_z); 
55     }
56     
57     Vec3 reverse1() { 
58         return new Vec3(-this.m_x, -this.m_y, -this.m_z); 
59     }
60     
61     Vec3 sub1(Vec3 v) {
62         return new Vec3(this.m_x-v.m_x, this.m_y-v.m_y, this.m_z-v.m_z); 
63     }
64     
65     Vec3 mul1(float s) {
66         return new Vec3(this.m_x*s, this.m_y*s, this.m_z*s); 
67     }
68     
69     Vec3 div1(float s) {
70         return new Vec3(this.m_x/s, this.m_y/s, this.m_z/s); 
71     }
72
73     float mul2(Vec3 v) { 
74         return this.m_x*v.m_x + this.m_y*v.m_y + this.m_z*v.m_z; 
75     }
76     
77     Vec3 clone() {
78         return new Vec3(this.m_x, this.m_y, this.m_z); 
79     }
80     
81     boolean isLess(Vec3 v) {
82         if((this.m_x > v.m_x) || (this.m_y > v.m_y) || (this.m_z > v.m_z)) {
83             return false;
84         } else {
85             return true;
86         }
87     }
88 }