Project

General

Profile

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

library / src / main / java / org / distorted / library / type / Static4D.java @ fe6fe99a

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
  Static4D(int dim, float vx, float vy, float vz, float vw)
36
    {
37
    super(dim,vx,vy,vz);
38
    w = vw;
39
    }
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42
/**
43
 * Constructor that initialises the value of the four floats to (vx,vy,vz,vw).   
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
 * @param vw value of the fourth float.
49
 */ 
50
  public Static4D(int vx, int vy, int vz, int vw)
51
    {
52
    super(4,vx,vy,vz);
53
    w = vw;
54
    }
55

    
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57
/**
58
 * Constructor that initialises the value of the four floats to (vx,vy,vz,vw).   
59
 *   
60
 * @param vx value of the first float.
61
 * @param vy value of the second float.
62
 * @param vz value of the third float.
63
 * @param vw value of the fourth float.
64
 */ 
65
  public Static4D(float vx, float vy, float vz, float vw)
66
    {
67
    super(4,vx,vy,vz);
68
    w = vw;
69
    }
70

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

    
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89
/**
90
 * Reset the value of the floats to (vx,vy,vz,vw).
91
 * 
92
 * @param vx new value of the first float
93
 * @param vy new value of the second float
94
 * @param vz new value of the third float
95
 * @param vw new value of the fourth float
96
 */
97
  public void set(float vx, float vy, float vz, float vw)
98
    {
99
    x = vx;
100
    y = vy;
101
    z = vz;
102
    w = vw;
103
    }
104

    
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106
/**
107
 * Resets the value of the fourth float.
108
 *
109
 * @param ow new value of the fourth float.
110
 */
111
  public void set4(int ow)
112
    {
113
    w = ow;
114
    }
115

    
116
///////////////////////////////////////////////////////////////////////////////////////////////////
117
/**
118
 * Resets the value of the fourth float.
119
 *
120
 * @param ow new value of the fourth float.
121
 */
122
  public void set4(float ow)
123
    {
124
    w = ow;
125
    }
126

    
127
///////////////////////////////////////////////////////////////////////////////////////////////////
128
/**
129
 * Return the value of the fourth float contained.
130
 * 
131
 * @return The fourth float.
132
 */
133
  public float getW()
134
    {
135
    return w;  
136
    }
137

    
138
  }
(17-17/18)