• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.cooliris.media;
18 
19 public final class Vector3f {
20     public float x;
21     public float y;
22     public float z;
23 
Vector3f()24     public Vector3f() {
25 
26     }
27 
Vector3f(float x, float y, float z)28     public Vector3f(float x, float y, float z) {
29         set(x, y, z);
30     }
31 
Vector3f(Vector3f vector)32     public Vector3f(Vector3f vector) {
33         x = vector.x;
34         y = vector.y;
35         z = vector.z;
36     }
37 
set(Vector3f vector)38     public void set(Vector3f vector) {
39         x = vector.x;
40         y = vector.y;
41         z = vector.z;
42     }
43 
set(float x, float y, float z)44     public void set(float x, float y, float z) {
45         this.x = x;
46         this.y = y;
47         this.z = z;
48     }
49 
add(Vector3f vector)50     public void add(Vector3f vector) {
51         x += vector.x;
52         y += vector.y;
53         z += vector.z;
54     }
55 
subtract(Vector3f vector)56     public void subtract(Vector3f vector) {
57         x -= vector.x;
58         y -= vector.y;
59         z -= vector.z;
60     }
61 
equals(Vector3f vector)62     public boolean equals(Vector3f vector) {
63         if (x == vector.x && y == vector.y && z == vector.z)
64             return true;
65         return false;
66     }
67 
68     @Override
toString()69     public String toString() {
70         return (new String("(" + x + ", " + y + ", " + z + ")"));
71     }
72 
add(float x, float y, float z)73     public void add(float x, float y, float z) {
74         this.x += x;
75         this.y += y;
76         this.z += z;
77     }
78 
scale(float spreadValueX, float spreadValueY, float spreadValueZ)79     public void scale(float spreadValueX, float spreadValueY, float spreadValueZ) {
80         x *= spreadValueX;
81         y *= spreadValueY;
82         z *= spreadValueZ;
83     }
84 }
85