Jump to content
You must now use your email address to sign in [click for more info] ×

Clamp very small SVG transform matrix values to zero


Recommended Posts

Thanks to the Affinity team for having very clean and configurable SVG export!

 

One thing I noticed when not flattening transforms is that some very near zero values are exported inside affine transformation matrices which are no doubt just rounding errors in computations of positions. I've attached an SVG file that shows these, an example of which is: 

<g transform="matrix(1,-1.22465e-16,-1.22465e-16,-1,288,228)">

I was wondering if an option could be added to clamp these values to zero? Any value below the clamp value forces the value to zero, for example a clamp value of 2e-16 on the above would produce this output:

 

<g transform="matrix(1,0,0,-1,288,228)">

If the rounding error is not from computing the SVG export then another option that could work would be to add a cleanup option that would clamp values in the internal representation Affinity is using.

scream-schematic.svg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.