當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。