package jalview.datamodel;
/**
- * A bean that models a point with (x, y, z) coordinates and a reference to a
- * sequence
+ * A bean that models a set of (x, y, z) values and a reference to a sequence.
+ * As used in Principal Component Analysis, the (x, y, z) values are the
+ * sequence's score for the currently selected first, second and third
+ * dimensions of the PCA.
*/
public class SequencePoint
{
private final SequenceI sequence;
/*
- * x, y, z position in 3-D space
+ * x, y, z values
*/
public Point coord;
}
/**
- * Applies a negative translation of the 'shift' (x, y, z) coordinates
+ * Applies a translation to the (x, y, z) coordinates
*
* @param centre
*/
- public void translateBack(Point shift)
+ public void translate(float x, float y, float z)
{
- float x = coord.x - shift.x;
- float y = coord.y - shift.y;
- float z = coord.z - shift.z;
-
- coord = new Point(x, y, z);
+ coord = new Point(coord.x + x, coord.y + y, coord.z + z);
}
/**
- * Applies a positive translation of the 'shift' (x, y, z) coordinates
- *
- * @param centre
+ * string representation for ease of inspection in debugging or logging only
*/
- public void translate(Point shift)
+ @Override
+ public String toString()
{
- float x = coord.x + shift.x;
- float y = coord.y + shift.y;
- float z = coord.z + shift.z;
-
- coord = new Point(x, y, z);
+ return sequence.getName() + " " + coord.toString();
}
}