Skip to content

[graphics] modernize BBox handling in several classes#22167

Open
linev wants to merge 7 commits intoroot-project:masterfrom
linev:less_virtualx
Open

[graphics] modernize BBox handling in several classes#22167
linev wants to merge 7 commits intoroot-project:masterfrom
linev:less_virtualx

Conversation

@linev
Copy link
Copy Markdown
Member

@linev linev commented May 6, 2026

There are TAttBBox2D methods which are used in TPad::ShowGuidelines during objects moving.
These methods have several issues:

  1. They do not aware of NDC coordinates
  2. They do not aware of log scales
  3. Implementation is too complicated
  4. They are main user of TPad::PixeltoY() method which does not do that it should

I propose to add several protected methods in base TAttBBox2D class for coordinates transformation.
And use these methods in all derived classes to simplify code and resolve mentioned issues.

Also start reduce usage of TPad::PixeltoY() method.
Its main problem - it does not return real user coordinates but with some shift.
To get user Y coordinate one have to call:

gPad->PixeltoY(py - gPad->VtoPixel(0));

It is so since ROOT beginning - but it is wrong.
Reducing its usage in the code let us in the future fix wired behavior.

@linev linev self-assigned this May 6, 2026
@linev linev requested review from couet, dpiparo and pcanal as code owners May 6, 2026 15:56
@linev linev marked this pull request as draft May 6, 2026 15:57
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Test Results

    22 files      22 suites   3d 12h 25m 7s ⏱️
 3 850 tests  3 799 ✅ 0 💤 51 ❌
76 936 runs  76 885 ✅ 0 💤 51 ❌

For more details on these failures, see this check.

Results for commit 7b392e8.

♻️ This comment has been updated with latest results.

linev added 2 commits May 7, 2026 07:09
Exclude gVirtualX usage, invoke pad painter methods insted
Fully support NDC and normal coordiantes during moving
Like line drawing, one should use absolute coordinates when non-opaque drawing enabled.
@linev linev force-pushed the less_virtualx branch from 9e333a1 to f22fa13 Compare May 7, 2026 05:24
linev added 5 commits May 7, 2026 08:11
For many classes it is good guess that center of
bbox is geometrical center. So one not need to
reimplement it many times - just reuse values from GetBBox.

And when setting bbox center - one can directly
call setx and sety methods. Other classes will be updated correspondently

Also provide convenience methods to convert pad coordinates into
X and Y user coordinates - or NDC. While these methods used very often.
One has to use absolute coordinates
Support NDC coordinates
Implement only few methods,
other reusing them

Simplify code by very large extend
One not need to redefine similar methods - now base class
helps us
TLine defines now less virtual methods
@linev linev force-pushed the less_virtualx branch from f22fa13 to 7b392e8 Compare May 7, 2026 06:15
@linev linev marked this pull request as ready for review May 7, 2026 07:44
@linev linev requested a review from bellenot as a code owner May 7, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants