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

[Bug]: BBox not properly calculated #186

Open
jpirnay opened this issue Mar 16, 2022 · 10 comments
Open

[Bug]: BBox not properly calculated #186

jpirnay opened this issue Mar 16, 2022 · 10 comments

Comments

@jpirnay
Copy link
Contributor

jpirnay commented Mar 16, 2022

Summary Description

After applying a matrix command the bounding box for the resulting shape is not properly calculated.

Additional Details

Steps to reproduce:

circle 4cm 4cm 1cm
scale 1 2
matrix 1 0 0.5 1 0 0

This is true for Meerk40t 0.7 legacy:
image
As well for Meerk40t 0.8:
image

Crash logs

No response

MeerK40t Version

meerk40t 0.8 / 0.7legacy

MeerK40t Type

Source (zip/tar file from Github)

Your Operating System

Windows

@tatarize
Copy link
Member

Arg. That seems accurate. The arcs are weird when you apply a sheer to them they get wonky. I think there's a somewhat deep bug in the that sort of thing that I've glossed over for a year now where it technically fails one of the WC3 tests.

@Sophist-UK
Copy link
Contributor

I suspect that if this was a raster element, the raster might be limited by the bbox and bits would not be burned.

@tatarize
Copy link
Member

Yeah, you'd actually have to figure out a way to sheer the designs to trigger the bug. Which isn't something most people would figure out how to do since there's not something instantly naively in there. Except for jp's code there.

@Sophist-UK
Copy link
Contributor

  1. It depends whether the shear transform can be existing in the SVG file. If I create the thing in inkscape and have the correct (or incorrect) inkscape save settings, can I save it with the shear transformation and get it into MK as a raster element. If so that makes it significantly more likely.
  2. I suspect that this is a bug in SVGelements (because that is where bbox resides) - in which case even though this might be rare in MK, it may be far less rare in a different project using SVGelements.

@tatarize
Copy link
Member

The coords-trans-08-t.svg test also fails since it uses sheered arcs. The problem might actually be somewhat fundamental within svgelements. I've never tracked it down.

coords-trans-08-t.zip

@Sophist-UK
Copy link
Contributor

I suspect that it's fundamental to the calculations. However I suspect that the math had probably already been done by someone in open source code somewhere...

@jpirnay
Copy link
Contributor Author

jpirnay commented Mar 20, 2022

I suspect that it's fundamental to the calculations. However I suspect that the math had probably already been done by someone in open source code somewhere...

Agree, you don't need skew for it, try:

circle 4cm 4cm 2cm
rotate 30deg
scale 1 2

et voilà:
image

BTW as you can see in the screenshot, the item manipulation code is nearly ported to 0.8...

@Sophist-UK
Copy link
Contributor

Wow - that is crazy broken.

@tatarize
Copy link
Member

Hm.

circle 4cm 4cm 2cm rotate 30deg scale 1 2 is totally wrong about the bounds there.
circle 4cm 4cm 2cm scale 1 2 rotate 30deg gets the bounds perfectly right.

Yeah, okay, does not require skew.

@tatarize tatarize transferred this issue from meerk40t/meerk40t Jul 17, 2022
@SimonbJohnson
Copy link

I think this might be related and I will try to create a test if not. We have found instances where circle or rect elements have a rotation applied to them and they are parsed to be more than 2x times bigger and in the wrong location.

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

No branches or pull requests

4 participants