R/polar2cart.R

# Coordenate Polar to Cartesian
polar2cart = function(rho, theta, center = c(0, 0), rad = TRUE)
{
	## convert degrees to radians
	toRad = pi/180
	
	if(!rad) theta = theta * toRad
	
	## convert to cartesian coordinates
	x = center[1] + rho * cos(theta)  
	y = center[2] + rho * sin(theta)  
	
	out = data.frame("x" = x, "y" = y)
	
	return(out) 
}#end polar2cart
salah31416/toolbox documentation built on June 3, 2019, 6:59 p.m.