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