public class Rotator extends Transformer {
	Matrix3D xrot_ = new Matrix3D(),
		yrot_ = new Matrix3D(),
		zrot_ = new Matrix3D(),
		temp_ = new Matrix3D();
    Rotator() {
        reset();
    }
    Rotator(Transformed child) { // urg
        super(child);
        reset();
    }
    Rotator(Vector3D val) {
        change(val);
        reset();
    }
    Rotator(Vector3D val,Transformed child) {
        super(child);
        reset();
        change(val);
    }
    void reset() {
        xrot_.identity();
        yrot_.identity();
        zrot_.identity();
    }
    String id() {
        return "rot";
    }
	// could consider order of rots, but i don't actually need that
	void recalc(Vector3D value) {
        //System.out.println("rot calc "+value);
		if(Math.abs(curr_.x()-value.x())>EPS) 
			xrot_.xRotation(value.x());
		if(Math.abs(curr_.y()-value.y())>EPS)
			yrot_.yRotation(value.y());
		if(Math.abs(curr_.z()-value.z())>EPS)
			zrot_.zRotation(value.z());
		xrot_.multiply(yrot_,temp_);
		temp_.multiply(zrot_,mat_);
        //System.out.println("rot calc mat "+mat_);
	}
}
