Skip to content

Commit

Permalink
Add horizontal distance to rectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-piles committed Dec 17, 2024
1 parent f031059 commit a706b1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pdf-document-layout-analysis"
version = "2024.12.17.1"
version = "2024.12.17.2"
description = "This tool is for PDF document layout analysis"
license = { file = "LICENSE" }
authors = [{ name = "HURIDOCS" }]
Expand Down
5 changes: 5 additions & 0 deletions src/pdf_features/Rectangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ def get_vertical_intersection(self, rectangle: "Rectangle") -> float:

return bottom - top

def get_horizontal_intersection(self, rectangle: "Rectangle") -> float:
left = max(self.left, rectangle.left)
right = min(self.right, rectangle.right)

return right - left

def area(self):
return self.width * self.height
Expand Down

0 comments on commit a706b1f

Please sign in to comment.