#' Writes a text file with a regular spaced grid ready fro R-LINE to use.
#' NOTE: if you do nto want to go in one of the directions put start=end and d = 0.
#'
#' @param fname output file name for grid
#' @param Xcenter X-coordinate center of polar grid
#' @param Ycenter Y-coordinate center of polar grid
#' @param Rstart smallest radii of grid
#' @param Rend largest radii of grid
#' @param dR spacing of radii
#' @param Zstart begining in Z-direction
#' @param Zend end in Z-direction
#' @param dZ spacing in Z-direction
#' @param dA spacing of angles
#' @param op_A "degrees" or "radian" for spacing variable
#'
#' @export mgswrite.RLINE_regulargrid
#########################################################################
mgswrite.RLINE_polargrid <- function(fname,Xcenter,Ycenter,Rstart,Rend,dR,Zstart,Zend,dZ,dA,op_A){
Rs <- seq(from=Rstart,to=Rend,by=dR)
if(op_A == "degrees"){
As <- seq(from=0,to=360,by=dA)
}else{
As <- seq(from=0,to=2*pi,by=dA)
}
Zs <- seq(from=Zstart,to=Zend,by=dZ)
write("This file contains receptor locations",file=fname,append=FALSE)
write("X_coordinate Y_Coordinate Z_Coordinate",file=fname,append=TRUE)
write("----------------------------------------------",file=fname,append=TRUE)
for(r in Rs){
for(a in As){
if(op_A == "degrees"){
x <- r*cos(a*pi/180)+Xcenter
y <- r*sin(a*pi/180)+Ycenter
}else{
x <- r*cos(a)+Xcenter
y <- r*sin(a)+Ycenter
}
for(z in Zs){
write(paste(x,y,z,sep='\t\t\t\t\t'),file=fname,append=TRUE)
}
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.