Shaft Encoder

So, first of all I just want to point out this code is from: http://playground.arduino.cc/Main/RotaryEncoders and is not mine. I have a magnetic shaft encoder mounted on a regular DC motor, my problem is that I cannot receive the exact angle of the motor. The encoder outputs+1 each 90 degrees(I then multiply by 90). And is there any relationship between valx,valy,valz and the angle??

#define encoder0PinA 2
#define encoder0PinB 3
int rounds= 0;
volatile unsigned int encoder0Pos = 0;
unsigned int tmp_Pos = 1;
unsigned int valx;
unsigned int valy;
unsigned int valz;

boolean A_set;
boolean B_set;

int enA = 9;
int in1 = 10;
int in2 = 11;

void setup() {

  pinMode(encoder0PinA, INPUT); 
  pinMode(encoder0PinB, INPUT); 
  // encoder pin on interrupt 0 (pin 2)
  attachInterrupt(0, doEncoderA, CHANGE);

// encoder pin on interrupt 1 (pin 3)
  attachInterrupt(1, doEncoderB, CHANGE);
  Serial.begin( 9600 );



    pinMode(enA, OUTPUT);

  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
          digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW); 
  analogWrite(enA, 225);
  Serial.begin (9600);
}


void loop(){ 
//Check each second for change in position

  if (tmp_Pos != encoder0Pos) {
    Serial.print("Index:"); Serial.print(encoder0Pos * 90,DEC);
    Serial.println();
    Serial.print("valx:");Serial.print(valx,DEC);
    Serial.println();
    Serial.print("valy:");Serial.print(valy,DEC);
    Serial.println();
    Serial.print("valz:");Serial.print(valz,DEC);
    Serial.println();
    tmp_Pos = encoder0Pos;

  }



    
}


// Interrupt on A changing state
void doEncoderA(){

  // Low to High transition?
  if (digitalRead(encoder0PinA) == HIGH) { 
    A_set = true;
    if (!B_set) {
      encoder0Pos = encoder0Pos + 1;
      valx=analogRead(0);
      valy=analogRead(1);
      valz=analogRead(2);
    }        
  }

  // High-to-low transition?
  if (digitalRead(encoder0PinA) == LOW) {
    A_set = false;
  }

}

// Interrupt on B changing state
void doEncoderB(){

  // Low-to-high transition?
  if (digitalRead(encoder0PinB) == HIGH) {   
    B_set = true;
    if (!A_set) {
      encoder0Pos = encoder0Pos - 1;
    }
  }

  // High-to-low transition?
  if (digitalRead(encoder0PinB) == LOW) {
    B_set = false;
  }
}

Thank you in advance.

I posted the question accidentally before finishing it, but I modified it.

What is connected to the three an analog pins you are reading? Why are you reading them only when the encoder sends a pulse?

What is connected to the three an analog pins you are reading? Why are you reading them only when the encoder sends a pulse?

Nothing is connected to those pins, but they still change values(the values are not consistent and seem very haphazard), and as I told you I didn't write this code, so I don't know how are valx,y,z are beneficial.

To the author of the code, reading valx, valy and valz probably had some useful purpose.

For you, there is no purpose, so remove all related code.

Note: some of the examples in the Playground link you gave are very bad (this one attempts to print within an interrupt, which will fail).