Project

General

Profile

Download (3.84 KB) Statistics
| Branch: | Revision:

library / src / main / java / org / distorted / library / Float2D.java @ d333eb6b

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;
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 Interpolator interpolates between.
27
 */
28

    
29
public class Float2D extends Float1D
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 Float2D(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 Float2D(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
 * Return the value of the second float contained.
88
 * 
89
 * @return The second float.
90
 */
91
  public float getY()
92
    {
93
    return y;  
94
    }
95

    
96
///////////////////////////////////////////////////////////////////////////////////////////////////
97
// end of class   
98
  }
(19-19/30)