-
-
Notifications
You must be signed in to change notification settings - Fork 313
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
boundingbox
cleanup
#2881
Comments
I think it makes sense to do a boundingbox including markers / text glyphs in screen space, and optionally offer to transform that back into 2d data space if desired. The thing is that it will not always be possible to even transform to the data space again, when nonlinear transformations are involved. |
Oh yea, the |
We should also cache boundingboxes, since they're somewhat expensive to calculate, and it's quite natural to query for them across different plotting calls/ functions... |
That sounds good. Maybe each atomic (or plot object) could cache its own boundingbox? Or maybe just know if it's outdated or not (based on changes in input data and transformation matrix) |
#3002 made me trip over this: Makie.jl/src/layouting/data_limits.jl Lines 140 to 142 in a26e6a1
We should fix this too. I also think it would be good to finish up #2766 before this and differentiate what would be world space and model/local space in opengl. I.e the space post |
It seems like the transform is being applied twice somewhere, but I can't figure out where. If we can resolve that, then bounding boxes would probably be a lot easier to manage.. |
Another thing to consider here is how to handle different input spaces with children. Let's say we have
If we call We could add a |
Makie.jl/src/basic_recipes/hvlines.jl Lines 41 to 46 in bd315b4
which effectively does this, and I have some code somewhere for 3D cases. |
Fixing #2245 should be part of this |
#3112 too |
The default pipeline for data limits of recipes is currently TODO: Move the recursion to A similar problem appears with h/vlines and h/vspan. In this case we want to ignore one dimension which currently happens via |
Yes let's continue the discussion here rather than in that other issue. I thought a |
I always shy away from unions because of performance but it probably doesn't matter much here. The majority of time is going to be spend generating limits, not evaluating the output. Something like I could also see some use in having the "invalid" limits around. For vlines and the like we really have one part data space limts and one part relative space limits (at least in theory) which could both be useful to know. So maybe we should just flag them by space with some kind of unknown/invalid/special space for when they don't fit in any of the normal boxes. |
I thought |
And for the special spaces, I would think we'd make special bbox request functions? |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
In short I think we should
data_limits
andboundingbox
doesspace
option inboundingbox
boundingboxes
and other intermediate stagesCurrently we have both
data_limits
andboundingbox
which for most plots only differ by an application of the model matrixMakie.jl/src/layouting/boundingbox.jl
Lines 1 to 8 in bc13edb
which often times is just an identity transform. The exception to this is
text
which returns a pixel space boundingbox for the scattered string(s).text
also includes the string boundingbox depending on markerspace indata_limits
Makie.jl/src/layouting/data_limits.jl
Lines 43 to 53 in 84a1cdf
which goes against my understanding of what
data_limits
is supposed to be.I think
data_limits
should only care about the positional arguments passed to a plot, as it does in most cases now.boundingbox
on the other hand should be a tight boundingbox around the full plot, including markersize, linewidth, etc. Including those will require some back and forth transformation, e.g. space -> markerspace, add markersize, markerspace -> space for scatter. (1, 2)In general it would be good to be able to specify the output space of a boundingbox. That way we could unify text with the other bounding boxes, and have some methods that skip the final transformation. (3)
Making different stages of the boundingbox computation available would also be useful to skip some of steps which might be unnecessary in some use cases. The pipeline here might be: (4)
rawboundingboxes(plot)
without the position argument applied (probably always in markerspace, as positions may influence the result in other spaces)boundingboxes(plot, space = plot.markerspace)
with positions applied (transform positions from space -> markerspace here, user defined output space)boundingbox(plot, space = plot.space)
which merges all the individual bounding boxes from the previous stepThese steps don't make sense for every (primitive) plot, but I think it's quite obvious when a plot has them and when it doesn't. Though it might be a bit more difficult to generalize this to recipe. Maybe we could just use
boundingboxes
on the child plots that implement them, or simply make that function only work on the primitive types.The text was updated successfully, but these errors were encountered: