Is quaternion comparison possible? I'm writing a Java class of Quaternions and I want to implement the Comparable
interface to use the Collections.sort(List
facility. I'm not expert at math, I really don't understand the things I read about Quaternions. So, can anyone tell me can I override the compareTo
method for Quaternions and how?
My class declarition:
public class Quaternion implements Serializable, Comparable {
private double s; // scalar part
private double i, j, k; // vectorel part
public Quaternion() {
super();
}
public Quaternion(double s, double i, double j, double k) {
super();
this.s = s;
this.i = i;
this.j = j;
this.k = k;
}