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.
58 lines
668 B
58 lines
668 B
package mightypork.utils.math.coord;
|
|
|
|
|
|
/**
|
|
* Coordinate with immutable numeric values.
|
|
*
|
|
* @author MightyPork
|
|
*/
|
|
class ConstVec extends VecView {
|
|
|
|
private final double x, y, z;
|
|
|
|
|
|
public ConstVec(Vec other) {
|
|
this(other.x(), other.y(), other.z());
|
|
}
|
|
|
|
|
|
public ConstVec(double x, double y) {
|
|
this(x, y, 0);
|
|
}
|
|
|
|
|
|
public ConstVec(double x, double y, double z) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.z = z;
|
|
}
|
|
|
|
|
|
@Override
|
|
public double x()
|
|
{
|
|
return x;
|
|
}
|
|
|
|
|
|
@Override
|
|
public double y()
|
|
{
|
|
return y;
|
|
}
|
|
|
|
|
|
@Override
|
|
public double z()
|
|
{
|
|
return z;
|
|
}
|
|
|
|
|
|
@Override
|
|
public VecView value()
|
|
{
|
|
return this; // it's constant already
|
|
}
|
|
|
|
}
|
|
|