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 AlignmentPattern : ResultPoint
\r
26 private float estimatedModuleSize;
\r
28 public AlignmentPattern(float posX, float posY, float estimatedModuleSize) {
\r
31 this.estimatedModuleSize = estimatedModuleSize;
\r
34 public float getX() {
\r
38 public float getY() {
\r
43 * <p>Determines if this alignment pattern "about equals" an alignment pattern at the stated
\r
44 * position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
\r
46 public bool aboutEquals(float moduleSize, float i, float j) {
\r
48 Math.Abs(i - posY) <= moduleSize &&
\r
49 Math.Abs(j - posX) <= moduleSize &&
\r
50 (Math.Abs(moduleSize - estimatedModuleSize) <= 1.0f ||
\r
51 Math.Abs(moduleSize - estimatedModuleSize) / estimatedModuleSize <= 0.1f);
\r