remove impl ResultPoint for FinderPattern & AlignmentPattern

This commit is contained in:
Vukašin Stepanović
2023-02-16 16:32:01 +00:00
parent 072d3d0ec7
commit 1322f7defa
6 changed files with 47 additions and 65 deletions

View File

@@ -182,10 +182,23 @@ impl Point {
f32::max(self.x.abs(), self.y.abs())
}
pub fn squaredDistance(self, p: Self) -> f32 {
let diff = self - p;
diff.x * diff.x + diff.y * diff.y
}
pub fn distance(self, p: Self) -> f32 {
(self - p).length()
}
pub fn abs(self) -> Self {
Self::new(self.x.abs(), self.y.abs())
}
pub fn fold<U, F: Fn(f32, f32) -> U>(self, f: F) -> U {
f(self.x, self.y)
}
/// Calculate a floating point pixel coordinate representing the 'center' of the pixel.
/// This is sort of the inverse operation of the PointI(PointF) conversion constructor.
/// See also the documentation of the GridSampler API.