1 |
6a06a912
|
Leszek Koltunski
|
package org.distorted.library;
|
2 |
|
|
|
3 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
4 |
|
|
/**
|
5 |
|
|
* A 3-dimensional data structure containing three floats. The floats have no particular meaning;
|
6 |
|
|
* when this data structure is used in Interpolators, we can think of it as a 3-dimensional Point
|
7 |
|
|
* a few of which the Interpolator interpolates between.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
public class Float3D extends Float2D
|
11 |
|
|
{
|
12 |
|
|
float z;
|
13 |
|
|
|
14 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
15 |
|
|
/**
|
16 |
|
|
* Constructor that initialises the value of the three floats to (vx,vy,vz).
|
17 |
|
|
*
|
18 |
|
|
* @param vx value of the first float.
|
19 |
|
|
* @param vy value of the second float.
|
20 |
|
|
* @param vz value of the third float.
|
21 |
|
|
*/
|
22 |
|
|
public Float3D(int vx, int vy, int vz)
|
23 |
|
|
{
|
24 |
|
|
super(vx,vy);
|
25 |
|
|
z = vz;
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
29 |
|
|
/**
|
30 |
|
|
* Constructor that initialises the value of the three floats to (vx,vy,vz).
|
31 |
|
|
*
|
32 |
|
|
* @param vx value of the first float.
|
33 |
|
|
* @param vy value of the second float.
|
34 |
|
|
* @param vz value of the third float.
|
35 |
|
|
*/
|
36 |
|
|
public Float3D(float vx, float vy, float vz)
|
37 |
|
|
{
|
38 |
|
|
super(vx,vy);
|
39 |
|
|
z = vz;
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
43 |
|
|
/**
|
44 |
|
|
* Reset the value of the floats to (vx,vy,vz).
|
45 |
|
|
*
|
46 |
|
|
* @param vx new value of the first float
|
47 |
|
|
* @param vy new value of the second float
|
48 |
|
|
* @param vz new value of the third float
|
49 |
|
|
*/
|
50 |
|
|
public void set(int vx, int vy, int vz)
|
51 |
|
|
{
|
52 |
|
|
x = vx;
|
53 |
|
|
y = vy;
|
54 |
|
|
z = vz;
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
|
|
/**
|
59 |
|
|
* Reset the value of the floats to (vx,vy,vz).
|
60 |
|
|
*
|
61 |
|
|
* @param vx new value of the first float
|
62 |
|
|
* @param vy new value of the second float
|
63 |
|
|
* @param vz new value of the third float
|
64 |
|
|
*/
|
65 |
|
|
public void set(float vx, float vy, float vz)
|
66 |
|
|
{
|
67 |
|
|
x = vx;
|
68 |
|
|
y = vy;
|
69 |
|
|
z = vz;
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
73 |
|
|
/**
|
74 |
|
|
* Return the value of the third float contained.
|
75 |
|
|
*
|
76 |
|
|
* @return The third float.
|
77 |
|
|
*/
|
78 |
|
|
public float getZ()
|
79 |
|
|
{
|
80 |
|
|
return z;
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
84 |
|
|
// end of class
|
85 |
|
|
}
|