1 |
d333eb6b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2016 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Distorted. //
|
5 |
|
|
// //
|
6 |
|
|
// Distorted is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Distorted is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
a4835695
|
Leszek Koltunski
|
package org.distorted.library.type;
|
21 |
6a06a912
|
Leszek Koltunski
|
|
22 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
23 |
|
|
/**
|
24 |
|
|
* A 3-dimensional data structure containing three floats. The floats have no particular meaning;
|
25 |
|
|
* when this data structure is used in Interpolators, we can think of it as a 3-dimensional Point
|
26 |
568b29d8
|
Leszek Koltunski
|
* a few of which the Dynamic interpolates between.
|
27 |
6a06a912
|
Leszek Koltunski
|
*/
|
28 |
|
|
|
29 |
568b29d8
|
Leszek Koltunski
|
public class Static3D extends Static2D implements Data3D
|
30 |
6a06a912
|
Leszek Koltunski
|
{
|
31 |
|
|
float z;
|
32 |
|
|
|
33 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
34 |
|
|
/**
|
35 |
|
|
* Constructor that initialises the value of the three floats to (vx,vy,vz).
|
36 |
|
|
*
|
37 |
|
|
* @param vx value of the first float.
|
38 |
|
|
* @param vy value of the second float.
|
39 |
|
|
* @param vz value of the third float.
|
40 |
|
|
*/
|
41 |
568b29d8
|
Leszek Koltunski
|
public Static3D(int vx, int vy, int vz)
|
42 |
6a06a912
|
Leszek Koltunski
|
{
|
43 |
|
|
super(vx,vy);
|
44 |
|
|
z = vz;
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
48 |
|
|
/**
|
49 |
|
|
* Constructor that initialises the value of the three floats to (vx,vy,vz).
|
50 |
|
|
*
|
51 |
|
|
* @param vx value of the first float.
|
52 |
|
|
* @param vy value of the second float.
|
53 |
|
|
* @param vz value of the third float.
|
54 |
|
|
*/
|
55 |
568b29d8
|
Leszek Koltunski
|
public Static3D(float vx, float vy, float vz)
|
56 |
6a06a912
|
Leszek Koltunski
|
{
|
57 |
|
|
super(vx,vy);
|
58 |
|
|
z = vz;
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
62 |
|
|
/**
|
63 |
|
|
* Reset the value of the floats to (vx,vy,vz).
|
64 |
|
|
*
|
65 |
|
|
* @param vx new value of the first float
|
66 |
|
|
* @param vy new value of the second float
|
67 |
|
|
* @param vz new value of the third float
|
68 |
|
|
*/
|
69 |
|
|
public void set(int vx, int vy, int vz)
|
70 |
|
|
{
|
71 |
|
|
x = vx;
|
72 |
|
|
y = vy;
|
73 |
|
|
z = vz;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
77 |
|
|
/**
|
78 |
|
|
* Reset the value of the floats to (vx,vy,vz).
|
79 |
|
|
*
|
80 |
|
|
* @param vx new value of the first float
|
81 |
|
|
* @param vy new value of the second float
|
82 |
|
|
* @param vz new value of the third float
|
83 |
|
|
*/
|
84 |
|
|
public void set(float vx, float vy, float vz)
|
85 |
|
|
{
|
86 |
|
|
x = vx;
|
87 |
|
|
y = vy;
|
88 |
|
|
z = vz;
|
89 |
|
|
}
|
90 |
8df64ab9
|
Leszek Koltunski
|
|
91 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
92 |
|
|
/**
|
93 |
|
|
* Resets the value of the third float.
|
94 |
|
|
*
|
95 |
|
|
* @param oz new value of the third float.
|
96 |
|
|
*/
|
97 |
|
|
public void set3(int oz)
|
98 |
|
|
{
|
99 |
|
|
z = oz;
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
103 |
|
|
/**
|
104 |
|
|
* Resets the value of the third float.
|
105 |
|
|
*
|
106 |
|
|
* @param oz new value of the third float.
|
107 |
|
|
*/
|
108 |
|
|
public void set3(float oz)
|
109 |
|
|
{
|
110 |
|
|
z = oz;
|
111 |
|
|
}
|
112 |
|
|
|
113 |
6a06a912
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
114 |
|
|
/**
|
115 |
|
|
* Return the value of the third float contained.
|
116 |
|
|
*
|
117 |
|
|
* @return The third float.
|
118 |
|
|
*/
|
119 |
|
|
public float getZ()
|
120 |
|
|
{
|
121 |
|
|
return z;
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
125 |
|
|
// end of class
|
126 |
|
|
}
|