|
|
@@ -20,6 +20,27 @@ public class BlochRenderer implements GLEventListener {
|
|
|
private float pitch = 0;
|
|
|
private float yaw = 0;
|
|
|
|
|
|
+ public float getNonlinearity() {
|
|
|
+ return nonlinearity;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setNonlinearity(float nonlinearity) {
|
|
|
+ this.nonlinearity = nonlinearity;
|
|
|
+ }
|
|
|
+
|
|
|
+ private float nonlinearRemap(float x){
|
|
|
+ // from (Mathematica):
|
|
|
+ // f[x_] := a + b*x + c*x^2 + d*x^3
|
|
|
+ // Solve[{f[0] == 0, f[1] == 1, f[1/2] == 1/2, f'[1/2] == s}, {a, b, c,
|
|
|
+ // d}]
|
|
|
+ float xx = x*x;
|
|
|
+ float xxx = xx*x;
|
|
|
+ return (3-2*nonlinearity)*x+6*(nonlinearity-1)*xx-4*(nonlinearity-1)*xxx;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private float nonlinearity = 1.0f;
|
|
|
+
|
|
|
public float getRadius() {
|
|
|
return radius;
|
|
|
}
|
|
|
@@ -85,7 +106,7 @@ public class BlochRenderer implements GLEventListener {
|
|
|
gl.glBegin(GL2.GL_LINE_STRIP);
|
|
|
for (int i = 0; i != blochSphere.getSize(); i++) {
|
|
|
gl.glVertex3f(blochSphere.pre[i], blochSphere.pim[i], blochSphere.f[i]);
|
|
|
- gl.glTexCoord1f((factor*blochSphere.t[i]-t0));
|
|
|
+ gl.glTexCoord1f(nonlinearRemap(factor*(blochSphere.t[i]-t0)));
|
|
|
}
|
|
|
gl.glEnd();
|
|
|
}
|