Project

General

Profile

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

library / src / main / java / org / distorted / library / type / Static3D.java @ 310e14fb

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 3-dimensional data structure containing three floats. The floats have no particular meaning; 
25
 * when this data structure is used in Dynamics, we can think of it as a 3-dimensional Point
26
 * a few of which the Dynamic interpolates between.
27
 */
28

    
29
public class Static3D extends Static2D  implements Data3D
30
  {
31
  float z;
32

    
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

    
35
  Static3D(int dim, float vx, float vy, float vz)
36
    {
37
    super(dim,vx,vy);
38
    z = vz;
39
    }
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42
/**
43
 * Constructor that initialises the value of the three floats to (vx,vy,vz).   
44
 *   
45
 * @param vx value of the first float.
46
 * @param vy value of the second float.
47
 * @param vz value of the third float.
48
 */ 
49
  public Static3D(int vx, int vy, int vz)
50
    {
51
    super(3,vx,vy);
52
    z = vz;
53
    }
54

    
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56
/**
57
 * Constructor that initialises the value of the three floats to (vx,vy,vz).   
58
 *   
59
 * @param vx value of the first float.
60
 * @param vy value of the second float.
61
 * @param vz value of the third float.
62
 */ 
63
  public Static3D(float vx, float vy, float vz)
64
    {
65
    super(3,vx,vy);
66
    z = vz;
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70
/**
71
 * Reset the value of the floats to (vx,vy,vz).
72
 * 
73
 * @param vx new value of the first float
74
 * @param vy new value of the second float
75
 * @param vz new value of the third float
76
 */
77
  public void set(int vx, int vy, int vz)
78
    {
79
    x = vx;
80
    y = vy;
81
    z = vz;
82
    }
83

    
84
///////////////////////////////////////////////////////////////////////////////////////////////////
85
/**
86
 * Reset the value of the floats to (vx,vy,vz).
87
 * 
88
 * @param vx new value of the first float
89
 * @param vy new value of the second float
90
 * @param vz new value of the third float
91
 */
92
  public void set(float vx, float vy, float vz)
93
    {
94
    x = vx;
95
    y = vy;
96
    z = vz;
97
    }
98

    
99
///////////////////////////////////////////////////////////////////////////////////////////////////
100
/**
101
 * Resets the value of the third float.
102
 *
103
 * @param oz new value of the third float.
104
 */
105
  public void set3(int oz)
106
    {
107
    z = oz;
108
    }
109

    
110
///////////////////////////////////////////////////////////////////////////////////////////////////
111
/**
112
 * Resets the value of the third float.
113
 *
114
 * @param oz new value of the third float.
115
 */
116
  public void set3(float oz)
117
    {
118
    z = oz;
119
    }
120

    
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122
/**
123
 * Return the value of the third float contained.
124
 * 
125
 * @return The third float.
126
 */
127
  public float getZ()
128
    {
129
    return z;  
130
    }
131

    
132
  }
(16-16/18)