java.lang.Math#tan ( )源码实例Demo

下面列出了java.lang.Math#tan ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: KEEL   文件: Adap.java
void Decodifica (double [] cromosoma) {
	int i, j;

	for (i=0; i<base_reglas.n_reglas; i++) {
		for (j=0; j<tabla.n_var_estado; j++) {
			base_reglas.BaseReglas[i].Ant[j].x0 = cromosoma[3*(i*tabla.n_var_estado+j)];
			base_reglas.BaseReglas[i].Ant[j].x1 = cromosoma[3*(i*tabla.n_var_estado+j)+1];
			base_reglas.BaseReglas[i].Ant[j].x2 = cromosoma[3*(i*tabla.n_var_estado+j)+1];
			base_reglas.BaseReglas[i].Ant[j].x3 = cromosoma[3*(i*tabla.n_var_estado+j)+2];
			base_reglas.BaseReglas[i].Ant[j].y = 1.0;
			base_reglas.BaseReglas[i].Ant[j].Nombre = "x" + (j+1);
			base_reglas.BaseReglas[i].Ant[j].Etiqueta = "E" + i + j;
			base_reglas.BaseReglas[i].Cons[j] = Math.tan (cromosoma[primer_gen_C2+i*(tabla.n_variables)+j]);
		}

		base_reglas.BaseReglas[i].Cons[j] = Math.tan (cromosoma[primer_gen_C2+i*(tabla.n_variables)+j]);
	}
}
 
源代码2 项目: KEEL   文件: Adap_M2TSK.java
/** Inference process with the rule "Consecuentes" */
double Alfa_Error (double [] Consecuentes) {
	int i, j;
	double suma, salida;
	float aux;

	for (i=0, suma=0.0; i<n_ejemplos_positivos; i++) {
		salida = Math.tan (Consecuentes[tabla.n_var_estado]);
		for (j=0; j<tabla.n_var_estado; j++) {
			salida += Math.tan (Consecuentes[j]) * tabla.datos[indices_ep[i]].ejemplo[j];
		}

		suma += tabla.datos[indices_ep[i]].nivel_cubrimiento * Math.pow (tabla.datos[indices_ep[i]].ejemplo[tabla.n_var_estado]-salida, 2.0);
	}

	return (suma);
}
 
源代码3 项目: KEEL   文件: Adap_Tun.java
void Decodifica (double [] cromosoma) {
	int i, j;

	for (i=0; i<base_reglas.n_reglas; i++) {
		for (j=0; j<tabla.n_var_estado; j++) {
			base_reglas.BaseReglas[i].Ant[j].x0 = cromosoma[3*(i*tabla.n_var_estado+j)];
			base_reglas.BaseReglas[i].Ant[j].x1 = cromosoma[3*(i*tabla.n_var_estado+j)+1];
			base_reglas.BaseReglas[i].Ant[j].x2 = cromosoma[3*(i*tabla.n_var_estado+j)+1];
			base_reglas.BaseReglas[i].Ant[j].x3 = cromosoma[3*(i*tabla.n_var_estado+j)+2];
			base_reglas.BaseReglas[i].Ant[j].y = 1.0;
			base_reglas.BaseReglas[i].Ant[j].Nombre = "x" + (j+1);
			base_reglas.BaseReglas[i].Ant[j].Etiqueta = "E" + i + j;
			base_reglas.BaseReglas[i].Cons[j] = Math.tan (cromosoma[primer_gen_C2+i*(tabla.n_variables)+j]);
		}

		base_reglas.BaseReglas[i].Cons[j] = Math.tan (cromosoma[primer_gen_C2+i*(tabla.n_variables)+j]);
	}
}
 
源代码4 项目: KEEL   文件: Adap.java
double Alfa_Error(double[] Consecuentes) {
  int i, j;
  double suma, salida;

  for (i = 0, suma = 0.0; i < n_ejemplos_positivos; i++) {
    /* Proceso de inferencia con una unica regla */
    /* inicializo la salida al valor b. Aplico la tangente para
        obtener el valor real porque dicho valor esta codificado
        con el angular coding */
    salida = Math.tan(Consecuentes[tabla.n_var_estado]);
    for (j = 0; j < tabla.n_var_estado; j++) {
      salida += Math.tan(Consecuentes[j]) *
          tabla.datos[indices_ep[i]].ejemplo[j];
    }

    suma += tabla.datos[indices_ep[i]].nivel_cubrimiento *
        Math.pow(tabla.datos[indices_ep[i]].ejemplo[tabla.n_var_estado] -
                 salida, 2.0);
  }

  return (suma);
}
 
源代码5 项目: KEEL   文件: Adap_Tun.java
void Decodifica(double[] cromosoma) {
  int i, j;

  for (i = 0; i < base_reglas.n_reglas; i++) {
    for (j = 0; j < tabla.n_var_estado; j++) {
      base_reglas.BaseReglas[i].Ant[j].x0 = cromosoma[3 * base_reglas.b_reglas[i][j]];
      base_reglas.BaseReglas[i].Ant[j].x1 = cromosoma[3 * base_reglas.b_reglas[i][j] + 1];
      base_reglas.BaseReglas[i].Ant[j].x2 = cromosoma[3 * base_reglas.b_reglas[i][j] + 1];
      base_reglas.BaseReglas[i].Ant[j].x3 = cromosoma[3 * base_reglas.b_reglas[i][j] + 2];
      base_reglas.BaseReglas[i].Ant[j].y = 1.0;
      base_reglas.BaseReglas[i].Ant[j].Nombre = "x" + (j + 1);
      base_reglas.BaseReglas[i].Ant[j].Etiqueta = "E" + i + j;
      base_reglas.BaseReglas[i].Cons[j] = Math.tan(cromosoma[primer_gen_C2 + i * (tabla.n_variables) + j]);
    }

    base_reglas.BaseReglas[i].Cons[j] = Math.tan(cromosoma[primer_gen_C2 + i * (tabla.n_variables) + j]);
  }
}
 
源代码6 项目: opengl   文件: BouncyCubeRenderer.java
public void onSurfaceChanged(GL10 gl, int width, int height) 
{
    gl.glViewport(0, 0, width, height);

    float aspectRatio;
    float zNear =.1f;
    float zFar =1000;
    float fieldOfView = 30.0f/57.3f;                                                                       
    float size;
    	
    gl.glEnable(GL10.GL_NORMALIZE);
    	
    aspectRatio=(float)width/(float)height;                       
	    	
    gl.glMatrixMode(GL10.GL_PROJECTION);                                  
    	
    size = zNear * (float)(Math.tan((double)(fieldOfView/2.0f)));   

    gl.glFrustumf(-size, size, -size /aspectRatio,                    
                           size /aspectRatio, zNear, zFar);
    	
    gl.glMatrixMode(GL10.GL_MODELVIEW);                              
}
 
源代码7 项目: opengl   文件: BouncyCubeRenderer.java
public void onSurfaceChanged(GL10 gl, int width, int height) 
{
    gl.glViewport(0, 0, width, height);

    float aspectRatio;
    float zNear =.1f;
    float zFar =1000;
    float fieldOfView = 30.0f/57.3f;                                                                       
    float size;
    	
    gl.glEnable(GL10.GL_NORMALIZE);
    	
    aspectRatio=(float)width/(float)height;                       
	    	
    gl.glMatrixMode(GL10.GL_PROJECTION);                                  
    	
    size = zNear * (float)(Math.tan((double)(fieldOfView/2.0f)));   

    gl.glFrustumf(-size, size, -size /aspectRatio,                    
                           size /aspectRatio, zNear, zFar);
    	
    gl.glMatrixMode(GL10.GL_MODELVIEW);                              
}
 
源代码8 项目: KEEL   文件: Adap.java
/** Inference process with the rule "Consecuentes" */
double Alfa_Error (double [] Consecuentes) {
	int i, j;
	double suma, salida;

	for (i=0, suma=0.0; i<n_ejemplos_positivos; i++) {
		salida = Math.tan (Consecuentes[tabla.n_var_estado]);
		for (j=0; j<tabla.n_var_estado; j++)
			salida += Math.tan (Consecuentes[j]) * tabla.datos[indices_ep[i]].ejemplo[j];

		suma += tabla.datos[indices_ep[i]].nivel_cubrimiento * Math.pow (tabla.datos[indices_ep[i]].ejemplo[tabla.n_var_estado]-salida, 2.0);
	}

	return (suma);
}
 
源代码9 项目: opengl   文件: SolarSystemRenderer.java
public void onSurfaceChanged(GL10 gl, int width, int height) {
     gl.glViewport(0, 0, width, height);

     /*
      * Set our projection matrix. This doesn't have to be done
      * each time we draw, but usually a new projection needs to
      * be set when the viewport is resized.
      */
     
 	float aspectRatio;
	float zNear =.1f;
	float zFar =1000f;
	float fieldOfView = 30.0f/57.3f;
	float	size;
	
	gl.glEnable(GL10.GL_NORMALIZE);
	
	aspectRatio=(float)width/(float)height;				//h/w clamps the fov to the height, flipping it would make it relative to the width
	
	//Set the OpenGL projection matrix
	
	gl.glMatrixMode(GL10.GL_PROJECTION);
	
	size = zNear * (float)(Math.tan((double)(fieldOfView/2.0f)));
	gl.glFrustumf(-size, size, -size/aspectRatio, size /aspectRatio, zNear, zFar);
	
	//Make the OpenGL modelview matrix the default
	
	gl.glMatrixMode(GL10.GL_MODELVIEW);
}
 
源代码10 项目: opengl   文件: SolarSystemRenderer.java
public void onSurfaceChanged(GL10 gl, int width, int height) {
     gl.glViewport(0, 0, width, height);

     /*
      * Set our projection matrix. This doesn't have to be done
      * each time we draw, but usually a new projection needs to
      * be set when the viewport is resized.
      */
     
 	float aspectRatio;
	float zNear =.1f;
	float zFar =1000f;
	float fieldOfView = 30.0f/57.3f;
	float	size;
	
	gl.glEnable(GL10.GL_NORMALIZE);
	
	aspectRatio=(float)width/(float)height;				//h/w clamps the fov to the height, flipping it would make it relative to the width
	
	//Set the OpenGL projection matrix
	
	gl.glMatrixMode(GL10.GL_PROJECTION);
	
	size = zNear * (float)(Math.tan((double)(fieldOfView/2.0f)));
	gl.glFrustumf(-size, size, -size/aspectRatio, size /aspectRatio, zNear, zFar);
	
	//Make the OpenGL modelview matrix the default
	
	gl.glMatrixMode(GL10.GL_MODELVIEW);
}
 
源代码11 项目: Llunatic   文件: Tangent.java
public Object tan(Object param)
	throws ParseException
{
	if (param instanceof Complex)
		return ((Complex)param).tan();
	else if (param instanceof Number)
		return new Double(Math.tan(((Number)param).doubleValue()));

	throw new ParseException("Invalid parameter type");
}
 
源代码12 项目: KEEL   文件: Est_evol.java
/** Generates the initial population of fathers */
public void InicializaPadres () {
	int i, j, y, Mu_primer_grupo, pos_ep, total_mayor;
	double y_med, y_min, y_max, h_max, h_exigido, x;
	double imagen;

	/* we calculate the average, maximum and minimum high, and the matching with which a example is considerated in the initial population */
	y_med = y_min = y_max = tabla.datos[indices_ep[0]].ejemplo[tabla.n_var_estado];
	h_max = tabla.datos[indices_ep[0]].nivel_cubrimiento;

	for (i=1; i<fun_adap.n_ejemplos_positivos; i++) {
		if (tabla.datos[indices_ep[i]].ejemplo[tabla.n_var_estado] > y_max)
			y_max = tabla.datos[indices_ep[i]].ejemplo[tabla.n_var_estado];
		if (tabla.datos[indices_ep[i]].ejemplo[tabla.n_var_estado] < y_min)
			y_min = tabla.datos[indices_ep[i]].ejemplo[tabla.n_var_estado];
		
		y_med += tabla.datos[indices_ep[i]].ejemplo[tabla.n_var_estado];
		if (tabla.datos[indices_ep[i]].nivel_cubrimiento > h_max)
			h_max = tabla.datos[indices_ep[i]].nivel_cubrimiento;
	}

	y_med /= fun_adap.n_ejemplos_positivos;
	h_exigido = porcentaje_h * h_max;

	/* Inicialization of a individual with 'b' value same as the average high and with the 'a' values to 0 */
	for (j=0; j<tabla.n_var_estado; j++)  Padres[0].Gene[j] = 0;
	Padres[0].Gene[tabla.n_var_estado] = Math.atan(y_med);

	/* Inicialization of the porcentaje_Mu * Mu individuals with 'b' value equal to a random value in the rank [y_min,y_max] and with the 'a' values to 0 */
	Mu_primer_grupo = (int) (porcentaje_Mu * Mu + 1);
	for (i=1; i<Mu_primer_grupo; i++) {
		for (j=0; j<tabla.n_var_estado; j++)  Padres[i].Gene[j] = 0;
		Padres[i].Gene[tabla.n_var_estado] = Math.atan(Randomize.Randdouble (y_min,y_max));
	}

	/* Inicialization of the remaining individuals with the random 'a' values and with a the 'b' value for any to example is in the plane */
	for (i=Mu_primer_grupo; i<Mu; i++) {
		for (j=0; j<tabla.n_var_estado; j++) {
			if (Randomize.Rand ()<.5)  y = -1;
			else  y=1;

			x = Randomize.Rand ();
			Padres[i].Gene[j] = f(x,y);
		}
		
		/* we select randomly a example with a matching more high than "h_exigido" */
		for (total_mayor=pos_ep=0; pos_ep<fun_adap.n_ejemplos_positivos; pos_ep++)
			if (tabla.datos[indices_ep[pos_ep]].nivel_cubrimiento >= h_exigido)
				ind_mayor[total_mayor++] = pos_ep;
		
		if (total_mayor==0) {
			System.out.println("Error: The matching, with which a example is considerated in the initial population, isn't surmounted");
		}
		
		pos_ep = ind_mayor[Randomize.RandintClosed (0,total_mayor-1)];
		for (imagen=0.0,j=0; j<tabla.n_var_estado; j++)
			imagen += Math.tan (Padres[i].Gene[j]) * tabla.datos[indices_ep[pos_ep]].ejemplo[j];
		
		Padres[i].Gene[tabla.n_var_estado] = Math.atan(tabla.datos[indices_ep[pos_ep]].ejemplo[tabla.n_var_estado]-imagen);
	}


	/* Inicialization of the vector of tipical desviations */
	for (i=0; i<Mu; i++)
		for (j=tabla.n_variables; j<tabla.n_variables+n_sigma; j++)  Padres[i].Gene[j] = Valor_Inicial_Sigma;

	/* Inicialization of the vector of angles: arcotangente of 1.0 */
	for (i=0; i<Mu; i++)
		for (j=tabla.n_variables + n_sigma; j<tabla.n_variables+n_sigma+n_alfa; j++)  
			Padres[i].Gene[j] = Math.atan (1.0);
}
 
源代码13 项目: KEEL   文件: Est_evol_M2TSK.java
/** Generates the initial population of fathers */
public void InicializaPadres () {
	int i, j, y, Mu_primer_grupo, pos_ep, total_mayor;
	double y_med, y_min, y_max, h_max, h_exigido, x;
	double imagen;

	/* we calculate the average, maximum and minimum high, and the matching with which a example is considerated in the initial population */
	y_med = y_min = y_max = tabla.datos[fun_adap.indices_ep[0]].ejemplo[tabla.n_var_estado];
	h_max = tabla.datos[fun_adap.indices_ep[0]].nivel_cubrimiento;


	for (i=1; i<fun_adap.n_ejemplos_positivos; i++) {
		if (tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado] > y_max)  y_max = tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado];
		if (tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado] < y_min)  y_min = tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado];

		y_med += tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado];
		if (tabla.datos[fun_adap.indices_ep[i]].nivel_cubrimiento > h_max)  h_max = tabla.datos[fun_adap.indices_ep[i]].nivel_cubrimiento;
	    
	}

	y_med /= fun_adap.n_ejemplos_positivos;
	h_exigido = porcentaje_h * h_max;



	/* Inicialization of a individual with 'b' value same as the average high and with the 'a' values to 0 */
	for (j=0; j<tabla.n_var_estado; j++)  Padres[0].Gene[j] = 0;
	Padres[0].Gene[tabla.n_var_estado] = Math.atan(y_med);

	/* Inicialization of the porcentaje_Mu * Mu individuals with 'b' value equal to a random value in the rank [y_min,y_max] and with the 'a' values to 0 */
	Mu_primer_grupo = (int) (porcentaje_Mu * Mu + 1);
	for (i=1; i<=Mu_primer_grupo; i++) {
		for (j=0; j<tabla.n_var_estado; j++)  Padres[i].Gene[j] = 0;
		Padres[i].Gene[tabla.n_var_estado] = Math.atan(Randomize.Randdouble (y_min,y_max));
	}

	/* Inicialization of the remaining individuals with the random 'a' values and with a the 'b' value for any to example is in the plane */
	for (i=Mu_primer_grupo+1; i<Mu; i++) {
		for (j=0; j<tabla.n_var_estado; j++) {
			if (Randomize.Rand () < 0.5)  y = -1;
			else  y=1;

			x = Randomize.Rand ();
			Padres[i].Gene[j] = f(x,y);
		}

		/* we select randomly a example with a matching more high than "h_exigido" */
		for (total_mayor=pos_ep=0; pos_ep<fun_adap.n_ejemplos_positivos; pos_ep++)
			if (tabla.datos[fun_adap.indices_ep[pos_ep]].nivel_cubrimiento >= h_exigido)  ind_mayor[total_mayor++] = pos_ep;

		if (total_mayor==0) {
			System.out.println("Error: The matching, with which a example is considerated in the initial population, isn't surmounted");
		}

		pos_ep = ind_mayor[Randomize.RandintClosed (0,total_mayor-1)];
		for (imagen=0.0,j=0; j<tabla.n_var_estado; j++)
			imagen += Math.tan (Padres[i].Gene[j]) * tabla.datos[fun_adap.indices_ep[pos_ep]].ejemplo[j];

		Padres[i].Gene[tabla.n_var_estado] = Math.atan(tabla.datos[fun_adap.indices_ep[pos_ep]].ejemplo[tabla.n_var_estado]-imagen);
	}


	/* Inicialization of the vector of tipical desviations */
	for (i=0; i<Mu; i++)
		for (j=tabla.n_variables; j<tabla.n_variables+n_sigma; j++)  Padres[i].Gene[j] = Valor_Inicial_Sigma;

	/* Inicialization of the vector of angles: arcotangente of 1.0 */
	for (i=0; i<Mu; i++)
		for (j=tabla.n_variables + n_sigma; j<tabla.n_variables+n_sigma+n_alfa; j++)
			Padres[i].Gene[j] = Math.atan (1.0);
}
 
源代码14 项目: KEEL   文件: Est_mu_landa.java
/** Generates the initial population of fathers */
public void InicializaPadres() {
  int i, j, y, Mu_primer_grupo, pos_ep, total_mayor;
  double y_med, y_min, y_max, h_max, h_exigido, x;
  double imagen;

  /* we calculate the average, maximum and minimum high, and the matching with which a example is considerated in the initial population */
  y_med = y_min = y_max = tabla.datos[fun_adap.indices_ep[0]].ejemplo[tabla.
      n_var_estado];
  h_max = tabla.datos[fun_adap.indices_ep[0]].nivel_cubrimiento;

  for (i = 1; i < fun_adap.n_ejemplos_positivos; i++) {
    if (tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado] > y_max) {
      y_max = tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado];
    }
    if (tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado] < y_min) {
      y_min = tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado];
    }

    y_med += tabla.datos[fun_adap.indices_ep[i]].ejemplo[tabla.n_var_estado];
    if (tabla.datos[fun_adap.indices_ep[i]].nivel_cubrimiento > h_max) {
      h_max = tabla.datos[fun_adap.indices_ep[i]].nivel_cubrimiento;
    }
  }

  if (fun_adap.n_ejemplos_positivos > 0) {
    y_med /= fun_adap.n_ejemplos_positivos;
  }
  else {
    y_med = Double.MAX_VALUE;
  }
  h_exigido = porcentaje_h * h_max;

  /* Inicialization of a individual with 'b' value same as the average high and with the 'a' values to 0 */
  for (j = 0; j < tabla.n_var_estado; j++) {
    Padres[0].Gene[j] = 0;
  }
  Padres[0].Gene[tabla.n_var_estado] = Math.atan(y_med);

  /* Inicialization of the porcentaje_Mu * Mu individuals with 'b' value equal to a random value in the rank [y_min,y_max] and with the 'a' values to 0 */
  Mu_primer_grupo = (int) (porcentaje_Mu * Mu + 1);
  for (i = 1; i <= Mu_primer_grupo; i++) {
    for (j = 0; j < tabla.n_var_estado; j++) {
      Padres[i].Gene[j] = 0;
    }
    Padres[i].Gene[tabla.n_var_estado] = Math.atan(Randomize.Randdouble(y_min,
        y_max));
  }

  /* Inicialization of the remaining individuals with the random 'a' values and with a the 'b' value for any to example is in the plane */
  for (i = Mu_primer_grupo + 1; i < Mu; i++) {
    for (j = 0; j < tabla.n_var_estado; j++) {
      if (Randomize.Rand() < 0.5) {
        y = -1;
      }
      else {
        y = 1;
      }

      x = Randomize.Rand();
      Padres[i].Gene[j] = f(x, y);
    }

    /* we select randomly a example with a matching more high than "h_exigido" */
    for (total_mayor = pos_ep = 0; pos_ep < fun_adap.n_ejemplos_positivos;
         pos_ep++) {
      if (tabla.datos[fun_adap.indices_ep[pos_ep]].nivel_cubrimiento >= h_exigido) {
        ind_mayor[total_mayor++] = pos_ep;
      }
    }

    if (total_mayor == 0) {
      System.out.println("Error: The matching, with which a example is considerated in the initial population, isn't surmounted");
    }

    pos_ep = ind_mayor[Randomize.RandintClosed(0, total_mayor - 1)];
    for (imagen = 0.0, j = 0; j < tabla.n_var_estado; j++) {
      imagen += Math.tan(Padres[i].Gene[j]) *
          tabla.datos[fun_adap.indices_ep[pos_ep]].ejemplo[j];
    }

    Padres[i].Gene[tabla.n_var_estado] = Math.atan(tabla.datos[fun_adap.indices_ep[
        pos_ep]].ejemplo[tabla.n_var_estado] - imagen);
  }

  /* Inicialization of the vector of tipical desviations */
  for (i = 0; i < Mu; i++) {
    for (j = tabla.n_variables; j < tabla.n_variables + n_sigma; j++) {
      Padres[i].Gene[j] = Valor_Inicial_Sigma;
    }
  }

  /* Inicialization of the vector of angles: arcotangente of 1.0 */
  for (i = 0; i < Mu; i++) {
    for (j = tabla.n_variables + n_sigma;
         j < tabla.n_variables + n_sigma + n_alfa; j++) {
      Padres[i].Gene[j] = Math.atan(1.0);
    }
  }
}
 
源代码15 项目: satstat   文件: UTM.java
public static String lat_lon_to_utm(double Lat, double Long, Context c) {

        double deg2rad = Math.PI / 180.0;
        double rad2deg = 180.0 / Math.PI;

        // Parameters for WGS-84
        double a = 6378137.0;
        double eccSquared = 0.00669438;
        double k0 = 0.9996;

        double LongTemp = (Long + 180) - (int) ((Long + 180) / 360) * 360 - 180;
        int ZoneNumber = ((int) (LongTemp + 180) / 6) + 1;

        double LatRad = Lat * deg2rad;
        double LongRad = LongTemp * deg2rad;

        if (Lat >= 56.0 && Lat < 64.0 && LongTemp >= 3.0 && LongTemp < 12.0) {
            ZoneNumber = 32;
        }

        // Special zones for Svalbard
        if (Lat >= 72.0 && Lat < 84.0)
            if (LongTemp >= 0.0 && LongTemp < 9.0)
                ZoneNumber = 31;
            else if (LongTemp >= 9.0 && LongTemp < 21.0) ZoneNumber = 33;
            else if (LongTemp >= 21.0 && LongTemp < 33.0) ZoneNumber = 35;
            else if (LongTemp >= 33.0 && LongTemp < 42.0) ZoneNumber = 37;

        double LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3;
        double LongOriginRad = LongOrigin * deg2rad;

        double eccPrimeSquared = (eccSquared) / (1 - eccSquared);
        double N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));
        double T = Math.tan(LatRad) * Math.tan(LatRad);
        double C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);
        double A = Math.cos(LatRad) * (LongRad - LongOriginRad);

        double M = a * ((1 - eccSquared / 4
                - 3 * eccSquared * eccSquared / 64
                - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad
                - (3 * eccSquared / 8
                + 3 * eccSquared * eccSquared / 32
                + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad)
                + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad)
                - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));

        double UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6
                + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120)
                + 500000.0);

        double UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24
                + (61
                - 58 * T
                + T * T
                + 600 * C
                - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720)));

        if (Lat > 84 || Lat < -80) {
            return (c.getString(R.string.utm_outside_latitude_range));
        } else {
            if (Lat < 0)
                UTMNorthing = UTMNorthing + 10000000.0;
            return (String.format("%d / %s / %,d / %,d", ZoneNumber, ((Lat > 0) ? "N" : "S"), Math.round(UTMEasting), Math.round(UTMNorthing)));
        }
    }
 
源代码16 项目: incubator-retired-mrql   文件: SystemFunctions.java
public static MR_double tan ( MR_double x ) { return new MR_double(Math.tan(x.get())); }