net.imglib2.util.Util.isApproxEqual()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中net.imglib2.util.Util.isApproxEqual()方法的一些代码示例,展示了Util.isApproxEqual()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isApproxEqual()方法的具体详情如下:
包路径:net.imglib2.util.Util
类名称:Util
方法名:isApproxEqual

Util.isApproxEqual介绍

暂无

代码示例

代码示例来源:origin: net.imglib2/imglib2

final protected static float[][] preComputeWeights( final int n, final int[] fadeOutDistance, final float exponent )
{
  // create lookup table for the weights
  final float[][] weights = new float[ n ][];
  for ( int d = 0; d < n; ++d )
    weights[ d ] = new float[ Math.max( 1, fadeOutDistance[ d ] ) ];
  for ( int d = 0; d < n; ++d )
  {
    final int maxDistance = weights[ d ].length;
    if ( maxDistance > 1 )
    {
      for ( int pos = 0; pos < maxDistance; ++pos )
      {
        final float relPos = pos / ( float ) ( maxDistance - 1 );
        // if exponent equals one means linear function
        if ( Util.isApproxEqual( exponent, 1f, 0.0001f ) )
          weights[ d ][ pos ] = 1 - relPos;
        else
          weights[ d ][ pos ] = ( float ) ( 1 - ( 1 / Math.pow( exponent, 1 - relPos ) ) ) * ( 1 + 1 / ( exponent - 1 ) );
      }
    }
    else
    {
      weights[ d ][ 0 ] = 0;
    }
  }
  return weights;
}

代码示例来源:origin: imglib/imglib2

final protected static float[][] preComputeWeights( final int n, final int[] fadeOutDistance, final float exponent )
{
  // create lookup table for the weights
  final float[][] weights = new float[ n ][];
  for ( int d = 0; d < n; ++d )
    weights[ d ] = new float[ Math.max( 1, fadeOutDistance[ d ] ) ];
  for ( int d = 0; d < n; ++d )
  {
    final int maxDistance = weights[ d ].length;
    if ( maxDistance > 1 )
    {
      for ( int pos = 0; pos < maxDistance; ++pos )
      {
        final float relPos = pos / ( float ) ( maxDistance - 1 );
        // if exponent equals one means linear function
        if ( Util.isApproxEqual( exponent, 1f, 0.0001f ) )
          weights[ d ][ pos ] = 1 - relPos;
        else
          weights[ d ][ pos ] = ( float ) ( 1 - ( 1 / Math.pow( exponent, 1 - relPos ) ) ) * ( 1 + 1 / ( exponent - 1 ) );
      }
    }
    else
    {
      weights[ d ][ 0 ] = 0;
    }
  }
  return weights;
}

代码示例来源:origin: net.preibisch/multiview-reconstruction

if ( !( size[ d ] < 1.0 + acceptedError || Util.isApproxEqual( size[ d ], sizeMaxResolution[ d ], acceptedError ) ) )
  isValid = false;

相关文章