2 * Copyright 2007 ZXing authors
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 using com.google.zxing;
\r
18 using com.google.zxing.common;
\r
20 namespace com.google.zxing.qrcode.detector
\r
22 public sealed class FinderPattern : ResultPoint
\r
26 private float estimatedModuleSize;
\r
29 public FinderPattern(float posX, float posY, float estimatedModuleSize) {
\r
32 this.estimatedModuleSize = estimatedModuleSize;
\r
36 public float getX() {
\r
40 public float getY() {
\r
44 public float getEstimatedModuleSize()
\r
46 return estimatedModuleSize;
\r
49 public int getCount()
\r
54 public void incrementCount()
\r
60 * <p>Determines if this finder pattern "about equals" a finder pattern at the stated
\r
61 * position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
\r
63 public bool aboutEquals(float moduleSize, float i, float j) {
\r
64 return Math.Abs(i - posY) <= moduleSize &&
\r
65 Math.Abs(j - posX) <= moduleSize &&
\r
66 (Math.Abs(moduleSize - estimatedModuleSize) <= 1.0f ||
\r
67 Math.Abs(moduleSize - estimatedModuleSize) / estimatedModuleSize <= 0.1f);
\r