Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculation of a rectangles height and width #2

Closed
maxnth opened this issue Jan 28, 2020 · 2 comments
Closed

Calculation of a rectangles height and width #2

maxnth opened this issue Jan 28, 2020 · 2 comments

Comments

@maxnth
Copy link
Contributor

maxnth commented Jan 28, 2020

I stumbled upon the following code regarding the calculation of height and width for rectangle:

public int getWidth() {
return right-left+1;
}
public int getHeight() {
return bottom-top+1;

Is there any specific reason for adding the constant factor of 1 to the calculated height/width?
When converting (for example) PAGEXML to ALTO the calculated width/height of TextBlocks is always one pixel too big because of this.

@maxnth maxnth changed the title Calculation of rectangles height and width Calculation of a rectangles height and width Jan 28, 2020
@chris1010010
Copy link
Contributor

The interpretation of a rectangle in PAGE is that both the left and right border belong to the rectangle (same with top and bottom of course).
That means if a rectangle spans from left=5 to right=8, for example, then you have:
5,6,7,8 = 4 pixels. This equals 8-5+1

@bertsky
Copy link
Contributor

bertsky commented Oct 21, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants