2 * Copyright 2007 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.google.zxing.qrcode.detector;
19 import com.google.zxing.ResultPoint;
22 * @author srowen@google.com (Sean Owen)
24 public final class FinderPattern implements ResultPoint {
26 private final float posX;
27 private final float posY;
28 private final float estimatedModuleSize;
31 FinderPattern(float posX, float posY, float estimatedModuleSize) {
34 this.estimatedModuleSize = estimatedModuleSize;
46 float getEstimatedModuleSize() {
47 return estimatedModuleSize;
54 void incrementCount() {
58 boolean aboutEquals(float moduleSize, float i, float j) {
59 return Math.abs(i - posY) <= moduleSize &&
60 Math.abs(j - posX) <= moduleSize &&
61 (Math.abs(moduleSize - estimatedModuleSize) <= 1.0f ||
62 Math.abs(moduleSize - estimatedModuleSize) / estimatedModuleSize <= 0.1f);