function [X,Y,Z]=rthetaz(center, R,theta, Z)
i=1;
steps=10;
maxinc=(theta(4)-theta(3))/steps;
mininc=(theta(2)-theta(1))/steps;
for z=Z(1):1:Z(2)
j=0;
    for v=theta(3):maxinc:theta(4) 
        X(2,i)=R(2)*cos(v) + center(1);
        Y(2,i)=R(2)*sin(v) + center(2);
        Z(2,i)=z;
        X(1,i)=R(1)*cos(theta(1)+mininc*j) + center(1);
        Y(1,i)=R(1)*sin(theta(1)+mininc*j) + center(2);
        Z(1,i)=z;
        i=i+1;
	j=j+1;
    end
end
