You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
668 B
59 lines
668 B
10 years ago
|
package mightypork.utils.math.coord;
|
||
|
|
||
|
|
||
|
/**
|
||
10 years ago
|
* Coordinate with immutable numeric values.
|
||
10 years ago
|
*
|
||
|
* @author MightyPork
|
||
|
*/
|
||
10 years ago
|
class ConstVec extends VecView {
|
||
10 years ago
|
|
||
10 years ago
|
private final double x, y, z;
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
public ConstVec(Vec other) {
|
||
10 years ago
|
this(other.x(), other.y(), other.z());
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
public ConstVec(double x, double y) {
|
||
10 years ago
|
this(x, y, 0);
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
public ConstVec(double x, double y, double z) {
|
||
10 years ago
|
this.x = x;
|
||
|
this.y = y;
|
||
|
this.z = z;
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
@Override
|
||
|
public double x()
|
||
|
{
|
||
|
return x;
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
10 years ago
|
@Override
|
||
|
public double y()
|
||
|
{
|
||
|
return y;
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public double z()
|
||
|
{
|
||
|
return z;
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
|
||
|
@Override
|
||
|
public VecView value()
|
||
|
{
|
||
|
return this; // it's constant already
|
||
|
}
|
||
|
|
||
10 years ago
|
}
|