1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
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
|
package org.distorted.library.type;
|
21
|
|
22
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
23
|
/**
|
24
|
* A 2-dimensional data structure containing two floats. The floats have no particular meaning;
|
25
|
* when this data structure is used in Interpolators, we can think of it as a 2-dimensional Point
|
26
|
* a few of which the Dynamic interpolates between.
|
27
|
*/
|
28
|
|
29
|
public class Static2D extends Static1D implements Data2D
|
30
|
{
|
31
|
float y;
|
32
|
|
33
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
34
|
/**
|
35
|
* Constructor that initialises the value of the two floats to (ox,oy).
|
36
|
*
|
37
|
* @param ox value of the first float.
|
38
|
* @param oy value of the second float.
|
39
|
*/
|
40
|
public Static2D(int ox, int oy)
|
41
|
{
|
42
|
super(ox);
|
43
|
y = oy;
|
44
|
}
|
45
|
|
46
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
47
|
/**
|
48
|
* Constructor that initialises the value of the two floats to (ox,oy).
|
49
|
*
|
50
|
* @param ox value of the first float.
|
51
|
* @param oy value of the second float.
|
52
|
*/
|
53
|
public Static2D(float ox, float oy)
|
54
|
{
|
55
|
super(ox);
|
56
|
y = oy;
|
57
|
}
|
58
|
|
59
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
60
|
/**
|
61
|
* Reset the value of the floats to (ox,oy).
|
62
|
*
|
63
|
* @param ox new value of the first float
|
64
|
* @param oy new value of the second float
|
65
|
*/
|
66
|
public void set(int ox, int oy)
|
67
|
{
|
68
|
x = ox;
|
69
|
y = oy;
|
70
|
}
|
71
|
|
72
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
73
|
/**
|
74
|
* Reset the value of the floats to (ox,oy).
|
75
|
*
|
76
|
* @param ox new value of the first float
|
77
|
* @param oy new value of the seond float
|
78
|
*/
|
79
|
public void set(float ox, float oy)
|
80
|
{
|
81
|
x = ox;
|
82
|
y = oy;
|
83
|
}
|
84
|
|
85
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
86
|
/**
|
87
|
* Resets the value of the second float.
|
88
|
*
|
89
|
* @param oy new value of the second float.
|
90
|
*/
|
91
|
public void set2(int oy)
|
92
|
{
|
93
|
y = oy;
|
94
|
}
|
95
|
|
96
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
97
|
/**
|
98
|
* Resets the value of the second float.
|
99
|
*
|
100
|
* @param oy new value of the second float.
|
101
|
*/
|
102
|
public void set2(float oy)
|
103
|
{
|
104
|
y = oy;
|
105
|
}
|
106
|
|
107
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
108
|
/**
|
109
|
* Return the value of the second float contained.
|
110
|
*
|
111
|
* @return The second float.
|
112
|
*/
|
113
|
public float getY()
|
114
|
{
|
115
|
return y;
|
116
|
}
|
117
|
|
118
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
119
|
// end of class
|
120
|
}
|