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 4-dimensional data structure containing four floats. The floats have no particular meaning;
|
25
|
* when this data structure is used in Dynamics, we can think of it as a 4-dimensional Point
|
26
|
* a few of which the Dynamic interpolates between.
|
27
|
*/
|
28
|
|
29
|
public class Static4D extends Static3D implements Data4D
|
30
|
{
|
31
|
float w;
|
32
|
|
33
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
34
|
/**
|
35
|
* Constructor that initialises the value of the four floats to (vx,vy,vz,vw).
|
36
|
*
|
37
|
* @param vx value of the first float.
|
38
|
* @param vy value of the second float.
|
39
|
* @param vz value of the third float.
|
40
|
* @param vw value of the fourth float.
|
41
|
*/
|
42
|
public Static4D(int vx, int vy, int vz, int vw)
|
43
|
{
|
44
|
super(vx,vy,vz);
|
45
|
w = vw;
|
46
|
}
|
47
|
|
48
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
49
|
/**
|
50
|
* Constructor that initialises the value of the four floats to (vx,vy,vz,vw).
|
51
|
*
|
52
|
* @param vx value of the first float.
|
53
|
* @param vy value of the second float.
|
54
|
* @param vz value of the third float.
|
55
|
* @param vw value of the fourth float.
|
56
|
*/
|
57
|
public Static4D(float vx, float vy, float vz, float vw)
|
58
|
{
|
59
|
super(vx,vy,vz);
|
60
|
w = vw;
|
61
|
}
|
62
|
|
63
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
64
|
/**
|
65
|
* Reset the value of the floats to (vx,vy,vz,vw).
|
66
|
*
|
67
|
* @param vx new value of the first float
|
68
|
* @param vy new value of the second float
|
69
|
* @param vz new value of the third float
|
70
|
* @param vw new value of the fourth float
|
71
|
*/
|
72
|
public void set(int vx, int vy, int vz, int vw)
|
73
|
{
|
74
|
x = vx;
|
75
|
y = vy;
|
76
|
z = vz;
|
77
|
w = vw;
|
78
|
}
|
79
|
|
80
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
81
|
/**
|
82
|
* Reset the value of the floats to (vx,vy,vz,vw).
|
83
|
*
|
84
|
* @param vx new value of the first float
|
85
|
* @param vy new value of the second float
|
86
|
* @param vz new value of the third float
|
87
|
* @param vw new value of the fourth float
|
88
|
*/
|
89
|
public void set(float vx, float vy, float vz, float vw)
|
90
|
{
|
91
|
x = vx;
|
92
|
y = vy;
|
93
|
z = vz;
|
94
|
w = vw;
|
95
|
}
|
96
|
|
97
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
98
|
/**
|
99
|
* Return the value of the fourth float contained.
|
100
|
*
|
101
|
* @return The fourth float.
|
102
|
*/
|
103
|
public float getW()
|
104
|
{
|
105
|
return w;
|
106
|
}
|
107
|
|
108
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
109
|
// end of class
|
110
|
}
|