RenderState.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package de.andreasvoelker;
  2. import org.jetbrains.annotations.Nullable;
  3. public class RenderState {
  4. private @Nullable BlochSphere blochSphere = null;
  5. private float radius = 3;
  6. private float pitch = 0;
  7. private float yaw = 0;
  8. private float lineWidth = 1.0f;
  9. private float nonlinearity = 1.0f;
  10. public @Nullable BlochSphere getBlochSphere() {
  11. return blochSphere;
  12. }
  13. public void setBlochSphere(@Nullable BlochSphere blochSphere) {
  14. this.blochSphere = blochSphere;
  15. }
  16. public float getRadius() {
  17. return radius;
  18. }
  19. public void setRadius(float radius) {
  20. if (radius < 0) radius = 0;
  21. this.radius = radius;
  22. }
  23. public float getPitch() {
  24. return pitch;
  25. }
  26. public void setPitch(float pitch) {
  27. while(pitch > 2*Math.PI) pitch -= (float)2*Math.PI;
  28. while(pitch < 0) pitch += (float)2*Math.PI;
  29. this.pitch = pitch;
  30. }
  31. public float getYaw() {
  32. return yaw;
  33. }
  34. public void setYaw(float yaw) {
  35. if (yaw > 0.4*Math.PI) yaw = (float) (0.4*Math.PI);
  36. if (yaw < -0.4*Math.PI) yaw = (float) (-0.4*Math.PI);
  37. this.yaw = yaw;
  38. }
  39. public float getLineWidth() {
  40. return lineWidth;
  41. }
  42. public void setLineWidth(float lineWidth) {
  43. this.lineWidth = lineWidth;
  44. }
  45. public float getNonlinearity() {
  46. return nonlinearity;
  47. }
  48. public void setNonlinearity(float nonlinearity) {
  49. this.nonlinearity = nonlinearity;
  50. }
  51. }