当前位置: 首页>>代码示例>>Java>>正文


Java FastMath.cos方法代码示例

本文整理汇总了Java中org.apache.commons.math3.util.FastMath.cos方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.cos方法的具体用法?Java FastMath.cos怎么用?Java FastMath.cos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.util.FastMath的用法示例。


在下文中一共展示了FastMath.cos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: value

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc}
 * @since 3.1
 */
public DerivativeStructure value(final DerivativeStructure t)
    throws DimensionMismatchException {
    final double x = t.getValue();
    double[] f = new double[t.getOrder() + 1];

    final double alpha = omega * x + phase;
    f[0] = amplitude * FastMath.cos(alpha);
    if (f.length > 1) {
        f[1] = -amplitude * omega * FastMath.sin(alpha);
        final double mo2 = - omega * omega;
        for (int i = 2; i < f.length; ++i) {
            f[i] = mo2 * f[i - 2];
        }
    }

    return t.compose(f);

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:22,代码来源:HarmonicOscillator.java

示例2: convertFromGeoToEarthCentred

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * 
 * @param lat
 * @param lon
 * @return
 */
public static double[] convertFromGeoToEarthCentred(final double lat, final double lon){
	double pH=GeoUtils.getGeoidH(lon, lat);
	
	double radLat=FastMath.toRadians(lat);
	double radLon=FastMath.toRadians(lon);
	
	// Convert from geographic coordinates to Earth centred Earth fixed coordinates
	double cosLat=FastMath.cos(radLat);
	double sinLat = FastMath.sin(radLat);
	double cosLon =FastMath.cos(radLon);
	double sinLon = FastMath.sin(radLon);
	
	double denomTmp = FastMath.sqrt((semiMajorAxis2) *(cosLat*cosLat) + (semiMinorAxis2)*(sinLat*sinLat));
	
	double pX = (semiMajorAxis2/denomTmp + pH) * cosLat * cosLon;
	double pY = (semiMajorAxis2/denomTmp + pH) * cosLat * sinLon;
	double pZ = (semiMinorAxis2/denomTmp + pH) * sinLat;
	
	double[] pXYZ = {pX ,pY, pZ};
	//double[] pXYZ = {4740162.032532615 , 787287.082659188, 4180253.542739194};
	return pXYZ;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:29,代码来源:GeoUtils.java

示例3: guessPhi

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Estimate a first guess of the phase.
 *
 * @param observations Observations, sorted w.r.t. abscissa.
 * @return the guessed phase.
 */
private double guessPhi(WeightedObservedPoint[] observations) {
    // initialize the means
    double fcMean = 0;
    double fsMean = 0;

    double currentX = observations[0].getX();
    double currentY = observations[0].getY();
    for (int i = 1; i < observations.length; ++i) {
        // one step forward
        final double previousX = currentX;
        final double previousY = currentY;
        currentX = observations[i].getX();
        currentY = observations[i].getY();
        final double currentYPrime = (currentY - previousY) / (currentX - previousX);

        double omegaX = omega * currentX;
        double cosine = FastMath.cos(omegaX);
        double sine = FastMath.sin(omegaX);
        fcMean += omega * currentY * cosine - currentYPrime * sine;
        fsMean += omega * currentY * sine + currentYPrime * cosine;
    }

    return FastMath.atan2(-fsMean, fcMean);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:31,代码来源:HarmonicFitter.java

示例4: vector

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Build the normalized vector corresponding to spherical coordinates.
 * @param theta azimuthal angle \( \theta \) in the x-y plane
 * @param phi polar angle \( \varphi \)
 * @return normalized vector
 * @exception OutOfRangeException if \( \varphi \) is not in the [\( 0; \pi \)] range
 */
private static Vector3D vector(final double theta, final double phi)
   throws OutOfRangeException {

    if (phi < 0 || phi > FastMath.PI) {
        throw new OutOfRangeException(phi, 0, FastMath.PI);
    }

    final double cosTheta = FastMath.cos(theta);
    final double sinTheta = FastMath.sin(theta);
    final double cosPhi   = FastMath.cos(phi);
    final double sinPhi   = FastMath.sin(phi);

    return new Vector3D(cosTheta * sinPhi, sinTheta * sinPhi, cosPhi);

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:22,代码来源:S2Point.java

示例5: cos

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Compute cosine of a derivative structure.
 * @param operand array holding the operand
 * @param operandOffset offset of the operand in its array
 * @param result array where result must be stored (for
 * cosine the result array <em>cannot</em> be the input
 * array)
 * @param resultOffset offset of the result in its array
 */
public void cos(final double[] operand, final int operandOffset,
                final double[] result, final int resultOffset) {

    // create the function value and derivatives
    double[] function = new double[1 + order];
    function[0] = FastMath.cos(operand[operandOffset]);
    if (order > 0) {
        function[1] = -FastMath.sin(operand[operandOffset]);
        for (int i = 2; i <= order; ++i) {
            function[i] = -function[i - 2];
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:26,代码来源:DSCompiler.java

示例6: Rotation

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Build a rotation from an axis and an angle.
 * @param axis axis around which to rotate
 * @param angle rotation angle
 * @param convention convention to use for the semantics of the angle
 * @exception MathIllegalArgumentException if the axis norm is zero
 * @since 3.6
 */
public Rotation(final Vector3D axis, final double angle, final RotationConvention convention)
    throws MathIllegalArgumentException {

  double norm = axis.getNorm();
  if (norm == 0) {
    throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS);
  }

  double halfAngle = convention == RotationConvention.VECTOR_OPERATOR ? -0.5 * angle : +0.5 * angle;
  double coeff = FastMath.sin(halfAngle) / norm;

  q0 = FastMath.cos (halfAngle);
  q1 = coeff * axis.getX();
  q2 = coeff * axis.getY();
  q3 = coeff * axis.getZ();

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:25,代码来源:Rotation.java

示例7: sin

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Compute sine of a derivative structure.
 * @param operand array holding the operand
 * @param operandOffset offset of the operand in its array
 * @param result array where result must be stored (for
 * sine the result array <em>cannot</em> be the input
 * array)
 * @param resultOffset offset of the result in its array
 */
public void sin(final double[] operand, final int operandOffset,
                final double[] result, final int resultOffset) {

    // create the function value and derivatives
    double[] function = new double[1 + order];
    function[0] = FastMath.sin(operand[operandOffset]);
    if (order > 0) {
        function[1] = FastMath.cos(operand[operandOffset]);
        for (int i = 2; i <= order; ++i) {
            function[i] = -function[i - 2];
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:26,代码来源:DSCompiler.java

示例8: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
 orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {
    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double[] lonlat=geotransform.getGeoFromPixel(xPos, yPos);
        double slantRange = getSlanteRange(lonlat[1], lonlat[0]);
      //  double sold=getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[1];
        double sampleDistRange= getPixelsize()[0];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);

    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage(),ex);
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:34,代码来源:Sentinel1.java

示例9: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
	if(satelliteSpeed==0){
 	satelliteSpeed = calcSatelliteSpeed();
     orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());
	}    

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {

    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double slantRange = getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[0];
        double sampleDistRange =getPixelsize()[1];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);
    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:35,代码来源:EnvisatImage.java

示例10: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
  public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
  	float prf=0;
  	if(isScanSar())
  		prf=NOMINAL_PRF; //Nominal PRF
else
	try {
		prf=prop.getPrf();
	} catch (Exception e) {
		logger.warn("Error reading PRF",e);
		prf=0;
	}
  	
   satelliteSpeed = calcSatelliteSpeed();

      double temp, deltaAzimuth, deltaRange;
      int[] output = new int[2];

      try {
      	// already in radian
          double incidenceAngle = getIncidence(xPos);
          double slantRange = ((CeosAlosProperties)prop).getSlantRange();

          double sampleDistAzim = getPixelsize()[0];
          double sampleDistRange =getPixelsize()[1];

          temp = (((CeosAlosProperties)prop).getWaveLength() * slantRange * prf) /
                  (2 * satelliteSpeed * (1 - FastMath.cos(ORBIT_INCLINATION) / REV_PER_DAY));

          //azimuth and delta in number of pixels
          deltaAzimuth = temp / sampleDistAzim;
          deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

          output[0] = (int) FastMath.floor(deltaAzimuth);
          output[1] = (int) FastMath.floor(deltaRange);
      } catch (Exception ex) {
      	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
      }
  	return output;
  }
 
开发者ID:ec-europa,项目名称:sumo,代码行数:41,代码来源:GDALAlosCeos.java

示例11: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
	if(satelliteSpeed==0){
 	satelliteSpeed = calcSatelliteSpeed();
     orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());
	}

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {

    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double slantRange = getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[0];
        double sampleDistRange =getPixelsize()[1];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);

    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:36,代码来源:AbstractCosmoSkymedImage.java

示例12: getAmbiguityCorrection

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
public int[] getAmbiguityCorrection(final int xPos,final int yPos) {
	if(satelliteSpeed==0){
 	satelliteSpeed = calcSatelliteSpeed();
     orbitInclination = FastMath.toRadians(getSatelliteOrbitInclination());
	}

    double temp, deltaAzimuth, deltaRange;
    int[] output = new int[2];

    try {
    	// already in radian
        double incidenceAngle = getIncidence(xPos);
        double slantRange = getSlantRange(xPos,incidenceAngle);
        double prf = getPRF(xPos,yPos);

        double sampleDistAzim = getPixelsize()[0];
        double sampleDistRange =getPixelsize()[1];

        temp = (getRadarWaveLenght() * slantRange * prf) /
                (2 * satelliteSpeed * (1 - FastMath.cos(orbitInclination) / getRevolutionsPerday()));

        //azimuth and delta in number of pixels
        deltaAzimuth = temp / sampleDistAzim;
        deltaRange = (temp * temp) / (2 * slantRange * sampleDistRange * FastMath.sin(incidenceAngle));

        output[0] = (int) FastMath.floor(deltaAzimuth);
        output[1] = (int) FastMath.floor(deltaRange);

    } catch (Exception ex) {
    	logger.error("Problem calculating the Azimuth ambiguity:"+ex.getMessage());
    }
    return output;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:35,代码来源:TerrasarXImage.java

示例13: setRotationAngle

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Sets the rotation angle.
 */
public void setRotationAngle(double angle)
{
    rotation = angle;
    sin_rotation = FastMath.sin(angle * DEGTORAD);
    cos_rotation = FastMath.cos(angle * DEGTORAD);
    sx_cos = -scale_x * cos_rotation;
    sx_sin = -scale_x * sin_rotation;
    sy_cos = -scale_y * cos_rotation;
    sy_sin = scale_y * sin_rotation;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:14,代码来源:SurfacePlotProjector.java

示例14: setElevationAngle

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Sets the elevation angle.
 */
public void setElevationAngle(double angle)
{
    elevation = angle;
    sin_elevation = FastMath.sin(angle * DEGTORAD);
    cos_elevation = FastMath.cos(angle * DEGTORAD);
    sz_cos = scale_z * cos_elevation;
    sz_sin = scale_z * sin_elevation;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:12,代码来源:SurfacePlotProjector.java

示例15: testZ00

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Test Z_00, which must be equal to 1.0 + 0.0i for all values ofs r
 * and theta.
 */
@Test
@DisplayName("Test Z_00")
void testZ00() {
    final ZernikeBasisFunction ZF1 = new ZernikeBasisFunction(0, 0);
    final double increment = 1e-3;
    for (double r = 0.0; r <= 1.0f; r += increment) {
        for (double theta = 0; theta <= 2*Math.PI; theta += increment) {
            Complex v = new Complex(r * FastMath.cos(theta), r * FastMath.sin(theta));
            assertEquals(1.0, ZF1.value(v).abs(), 1e-8);
            assertEquals(0.0, ZF1.value(v).getArgument(), 1e-8);
        }
    }
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:18,代码来源:ZernikePolynomialsTest.java


注:本文中的org.apache.commons.math3.util.FastMath.cos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。