)
    -sin(phi)*sin(theta)  cos(phi)*sin(theta)   cos(theta) ]';

  r = rw*[cos(psiw+MM); zeros(1,M+1); sin(psiw+MM)+1];
  R{1} = bsxfun(@plus,A*r,[x; y; 0]);
  r = rw*[cos(psiw) -cos(psiw); 0 0; sin(psiw)+1 -sin(psiw)+1];
  R{2} = bsxfun(@plus,A*r,[x; y; 0]);
  r = rw*[sin(psiw) -sin(psiw); 0 0; -cos(psiw)+1 cos(psiw)+1];
  R{3} = bsxfun(@plus,A*r,[x; y; 0]);
  r = [0 rr*sin(psif); 0 0; rw rw+rr*cos(psif)];
  R{4} = bsxfun(@plus,A*r,[x; y; 0]);
  r = [rr*sin(psif)+rw*cos(psif)*cos(psit+MM); rw*sin(psit+MM)