Skip to content

Commit

Permalink
geometry: fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
arrufat committed Nov 9, 2024
1 parent 3a204d6 commit 15ed1c3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/geometry.zig
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn SimilarityTransform(comptime T: type) type {
matrix: Matrix(T, 2, 2) = Matrix(T, 2, 2).identity(),
bias: Matrix(T, 2, 1) = Matrix(T, 2, 1).initAll(0),

/// Finds the best similarity transforms that maps between the two given sets of points.
/// Finds the best similarity transform that maps between the two given sets of points.
pub fn find(from_points: []const Point2d(T), to_points: []const Point2d(T)) Self {
var transfrom = SimilarityTransform(T){};
transfrom.fit(from_points, to_points);
Expand All @@ -135,7 +135,7 @@ pub fn SimilarityTransform(comptime T: type) type {
return .{ .x = dst.at(0, 0) + self.bias.at(0, 0), .y = dst.at(1, 0) + self.bias.at(1, 0) };
}

/// Finds the best similarity transforms that maps between the two given sets of points.
/// Finds the best similarity transform that maps between the two given sets of points.
pub fn fit(self: *Self, from_points: []const Point2d(T), to_points: []const Point2d(T)) void {
assert(from_points.len >= 2);
assert(from_points.len == to_points.len);
Expand Down Expand Up @@ -213,14 +213,14 @@ pub fn AffineTransform(comptime T: type) type {
matrix: Matrix(T, 2, 2) = Matrix(T, 2, 2).identity(),
bias: Matrix(T, 2, 1) = Matrix(T, 2, 1).initAll(0),

/// Finds the best similarity transforms that maps between the two given sets of points.
/// Finds the best affine transform that maps between the two given sets of points.
pub fn find(from_points: [3]Point2d(T), to_points: [3]Point2d(T)) Self {
var transfrom = AffineTransform(T){};
transfrom.fit(from_points, to_points);
return transfrom;
}

/// Projects the given point using the similarity transform.
/// Projects the given point using the affine transform.
pub fn project(self: Self, point: Point2d(T)) Point2d(T) {
const src = Matrix(T, 2, 1){ .items = .{ .{point.x}, .{point.y} } };
var dst = self.matrix.dot(src);
Expand Down Expand Up @@ -288,7 +288,7 @@ pub fn ProjectiveTransform(comptime T: type) type {
const Self = @This();
matrix: Matrix(T, 3, 3) = Matrix(T, 3, 3).identity(),

/// Finds the best projective transforms that maps between the two given sets of points.
/// Finds the best projective transform that maps between the two given sets of points.
pub fn find(from_points: []const Point2d(T), to_points: []const Point2d(T)) Self {
var transfrom = ProjectiveTransform(T){};
transfrom.fit(from_points, to_points);
Expand All @@ -305,7 +305,7 @@ pub fn ProjectiveTransform(comptime T: type) type {
return .{ .x = dst.at(0, 0), .y = dst.at(1, 0) };
}

/// Finds the best projective transforms that maps between the two given sets of points.
/// Finds the best projective transform that maps between the two given sets of points.
pub fn fit(self: *Self, from_points: []const Point2d(T), to_points: []const Point2d(T)) void {
assert(from_points.len >= 4);
assert(from_points.len == to_points.len);
Expand Down

0 comments on commit 15ed1c3

Please sign in to comment.