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.
155 lines
2.0 KiB
155 lines
2.0 KiB
11 years ago
|
package mightypork.utils.math.vect;
|
||
11 years ago
|
|
||
|
|
||
|
import mightypork.utils.math.constraints.NumberConstraint;
|
||
11 years ago
|
import mightypork.utils.math.constraints.VectConstraint;
|
||
11 years ago
|
|
||
|
|
||
11 years ago
|
/**
|
||
|
* The most basic Vec methods
|
||
|
*
|
||
|
* @author MightyPork
|
||
|
*/
|
||
11 years ago
|
public interface Vect extends VectConstraint {
|
||
11 years ago
|
|
||
11 years ago
|
public static final VectVal ZERO = new VectVal(0, 0, 0);
|
||
|
public static final VectVal ONE = new VectVal(0, 0, 0);
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
|
* @return X coordinate
|
||
|
*/
|
||
|
double x();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @return Y coordinate
|
||
|
*/
|
||
|
double y();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @return Z coordinate
|
||
|
*/
|
||
|
double z();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @return X rounded
|
||
|
*/
|
||
|
int xi();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @return Y rounded
|
||
|
*/
|
||
|
int yi();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @return Z rounded
|
||
|
*/
|
||
|
int zi();
|
||
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* @return X constraint
|
||
11 years ago
|
*/
|
||
11 years ago
|
NumberConstraint xc();
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* @return Y constraint
|
||
11 years ago
|
*/
|
||
11 years ago
|
NumberConstraint yc();
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* @return Z constraint
|
||
11 years ago
|
*/
|
||
11 years ago
|
NumberConstraint zc();
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* Get vector size
|
||
|
*
|
||
|
* @return size
|
||
11 years ago
|
*/
|
||
11 years ago
|
double size();
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* @return true if zero
|
||
11 years ago
|
*/
|
||
11 years ago
|
public boolean isZero();
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* Get distance to other point
|
||
|
*
|
||
|
* @param point other point
|
||
|
* @return distance
|
||
11 years ago
|
*/
|
||
11 years ago
|
double distTo(Vect point);
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
|
* Get middle of line to other point
|
||
|
*
|
||
|
* @param point other point
|
||
|
* @return result
|
||
|
*/
|
||
11 years ago
|
VectVal midTo(Vect point);
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
|
* Create vector from this point to other point
|
||
|
*
|
||
|
* @param point second point
|
||
|
* @return result
|
||
|
*/
|
||
11 years ago
|
VectVal vecTo(Vect point);
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
|
* Get cross product (vector multiplication)
|
||
|
*
|
||
|
* @param vec other vector
|
||
|
* @return result
|
||
|
*/
|
||
11 years ago
|
VectVal cross(Vect vec);
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* Get dot product (scalar multiplication)
|
||
11 years ago
|
*
|
||
11 years ago
|
* @param vec other vector
|
||
|
* @return dot product
|
||
11 years ago
|
*/
|
||
11 years ago
|
double dot(Vect vec);
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* Get a view at current state, not propagating further changes.
|
||
|
*
|
||
|
* @return a immutable copy
|
||
|
*/
|
||
11 years ago
|
VectVal value();
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
|
* Get immutable proxy view at this vec
|
||
11 years ago
|
*
|
||
|
* @return immutable view
|
||
|
*/
|
||
11 years ago
|
VectView view();
|
||
11 years ago
|
|
||
11 years ago
|
|
||
|
/**
|
||
|
* Get a mutable copy of current values.
|
||
|
*
|
||
|
* @return mutable copy
|
||
|
*/
|
||
11 years ago
|
VectMutable mutable();
|
||
11 years ago
|
}
|