Rotatable Ellipsoid

Average rating
(0 votes)
Linear Plot

// This creates an ellipsoid
// INPUTS:
//   wname - name of ywave having 361 points
//              (presumes xwave of same length is named wname + "x")
//   (xo,yo) - center position of ellipse
//   (a, b) - elliptical dimesions to above
//   alpha - angle of rotation (counterclockwise)
// OUTPUTS:
//   make all changes directly in ywave and xwave
 
Function Ellipsoid(wname,xo,yo,a,b,alpha)
	string wname
	variable xo,yo,a,b,alpha
 
	wave yw = $wname
	wave xw = $(wname +"x")
 
	make/FREE/n=361 urx,ury
 
	variable cosalpha = cos(alpha*Pi/180), sinalpha = sin(alpha*Pi/180)
 
	urx = a*(cos(p*Pi/180))
	ury = b*(sin(p*Pi/180))
 
	xw = xo + cosalpha* urx - sinalpha*ury
	yw = yo + sinalpha*urx + cosalpha*ury
 
	return (0)	
end

Back to top