@Test
  public final void testCone() {
    try {
      PhysicalParameters parameters = new PhysicalParameters(25., TemperatureType.C);
      double z0 = parameters.calcZ0(BaseRadius);
      double waveNumber = parameters.calcWaveNumber(BaseFrequency);

      TerminationCalculator term = new IdealOpenEndCalculator();
      StateVector sv = term.calcStateVector(null, waveNumber, parameters);

      TransferMatrix tm =
          Tube.calcConeMatrix(waveNumber, BaseLength, BaseRadius, 0.75 * BaseRadius, parameters);
      assertEquals("Determinant incorrect", 1.0, tm.determinant().getReal(), 0.0001);
      assertEquals("Determinant.imag incorrect", 0.0, tm.determinant().getImaginary(), 0.0001);
      Complex zLoad = tm.multiply(sv).Impedance().divide(z0);

      assertEquals("Re(Z) incorrect", 0.03871, zLoad.getReal(), 0.00001);
      assertEquals("Im(Z) incorrect", -0.46038, zLoad.getImaginary(), 0.00001);

      BoreSectionCalculator boreCalc = new DefaultBoreSectionCalculator();
      BoreSection bore = new BoreSection(BaseLength, BaseRadius, 0.75 * BaseRadius);
      TransferMatrix tm2 = boreCalc.calcTransferMatrix(bore, waveNumber, parameters);
      assertEquals("Determinant 2 incorrect", 1.0, tm2.determinant().getReal(), 0.0001);
      assertEquals("Determinant.imag 2 incorrect", 0.0, tm2.determinant().getImaginary(), 0.0001);
      Complex zLoad2 = tm2.multiply(sv).Impedance().divide(z0);

      assertEquals("Re(Z2) incorrect", 0.03871, zLoad2.getReal(), 0.00001);
      assertEquals("Im(Z2) incorrect", -0.46038, zLoad2.getImaginary(), 0.00001);
    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
  @Test
  public final void testImpedance() {
    try {
      PhysicalParameters parameters = new PhysicalParameters(25., TemperatureType.C);

      double z0 = parameters.calcZ0(BaseRadius);

      Complex zLoad = Tube.calcZload(BaseFrequency, BaseRadius, parameters).divide(z0);
      assertEquals("Re(Z) incorrect", 0.00101768, zLoad.getReal(), 1.0e-6);
      assertEquals("Im(Z) incorrect", 0.039, zLoad.getImaginary(), 0.0001);

    } catch (Exception e) {
      fail(e.getMessage());
    }
  }
Esempio n. 3
0
  public CubeIDTexture(int cubes, int faces, Context context, GL10 gl) {
    super(cubes, faces, context, gl);

    loadCubeResID(context, gl);
    for (int i = 0; i < Tube.CubesEachTube; i++) {
      int[] visiblefaces = Tube.getVisibleFaces(i);
      for (int j = 0; j < visiblefaces.length; j++) {
        int whichface = visiblefaces[j];
        setTextureID(i, whichface, cubeResID[i]);
      }
    }

    /*
    		for(int i=0;i<Tube.CubesEachTube;i++)
    			for(int j=0;j<Cube.FacesEachCube;j++)
    				Log.i(TAG, "CubeIDTexture(...): " + "TextureID = " + Integer.toString(getTextureID(i,j)));
    */
  }