import ResultPoint from './../../ResultPoint' ; author Sean Owen
  export default class FinderPattern extends ResultPoint { public constructor ( posX , posY , private estimatedModuleSize , private count ? ) { super ( posX , posY ) ; if ( undefined === count ) { this . count = 1 ; } } public getEstimatedModuleSize ( ) { return this . estimatedModuleSize ; } public getCount ( ) { return this . count ; } /**
     * <p>Determines if this finder pattern "about equals" a finder pattern at the stated
     * position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
     */ public aboutEquals ( moduleSize , i , j ) { if ( Math . abs ( i - this . getY ( ) ) <= moduleSize && Math . abs ( j - this . getX ( ) ) <= moduleSize ) { const moduleSizeDiff = Math . abs ( moduleSize - this . estimatedModuleSize ) ; return moduleSizeDiff <= 1.0 || moduleSizeDiff <= this . estimatedModuleSize ; } return false ; } /**
     * Combines this object's current estimate of a finder pattern position and module size
     * with a new estimate. It returns a new {@code FinderPattern} containing a weighted average
     * based on count.
     */ public combineEstimate ( i , j , newModuleSize ) { const combinedCount = this . count + 1 ; const combinedX = ( this . count * this . getX ( ) + j ) / combinedCount ; const combinedY = ( this . count * this . getY ( ) + i ) / combinedCount ; const combinedModuleSize = ( this . count * this . estimatedModuleSize + newModuleSize ) / combinedCount ; return new FinderPattern ( combinedX , combinedY , combinedModuleSize , combinedCount ) ; } }