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

Configure precision (for floating-point rounding) #329

Open
valeriyo opened this issue Dec 12, 2024 · 1 comment
Open

Configure precision (for floating-point rounding) #329

valeriyo opened this issue Dec 12, 2024 · 1 comment

Comments

@valeriyo
Copy link

Currently, the output floats use 3-decimal digit precision, which is many cases (like 24x24 icons) is an overkill.

It would be neat, to be able to configure the floating point rounding to say, 2 digits.

Example:

        curveTo(9.224f, 14.336f, 9.324f, 14.744f, 9.46f, 15.112f)
        curveTo(9.604f, 15.48f, 9.8f, 15.772f, 10.048f, 15.988f)
        curveTo(10.296f, 16.204f, 10.616f, 16.312f, 11.008f, 16.312f)
        curveTo(11.352f, 16.312f, 11.648f, 16.268f, 11.896f, 16.18f)
        curveTo(12.152f, 16.092f, 12.416f, 15.964f, 12.688f, 15.796f)
        curveTo(12.36f, 15.604f, 12.112f, 15.308f, 11.944f, 14.908f)
        curveTo(11.776f, 14.508f, 11.664f, 14.048f, 11.608f, 13.528f)
        curveTo(11.552f, 13.008f, 11.524f, 12.472f, 11.524f, 11.92f)
        curveTo(11.524f, 11.4f, 11.54f, 10.908f, 11.572f, 10.444f)
        curveTo(11.604f, 9.98f, 11.62f, 9.52f, 11.62f, 9.064f)
        curveTo(11.62f, 8.768f, 11.596f, 8.488f, 11.548f, 8.224f)
        curveTo(11.508f, 7.952f, 11.416f, 7.732f, 11.272f, 7.564f)
        curveTo(11.128f, 7.388f, 10.904f, 7.3f, 10.6f, 7.3f)
        curveTo(10.376f, 7.3f, 10.164f, 7.328f, 9.964f, 7.384f)
        curveTo(9.764f, 7.44f, 9.56f, 7.512f, 9.352f, 7.6f)
        curveTo(9.272f, 7.512f, 9.16f, 7.44f, 9.016f, 7.384f)
        curveTo(8.872f, 7.328f, 8.696f, 7.3f, 8.488f, 7.3f)
        curveTo(7.936f, 7.3f, 7.464f, 7.384f, 7.072f, 7.552f)
        curveTo(6.68f, 7.72f, 6.304f, 7.928f, 5.944f, 8.176f)
        curveTo(5.992f, 8.376f, 6.044f, 8.588f, 6.1f, 8.812f)
        curveTo(6.156f, 9.036f, 6.204f, 9.248f, 6.244f, 9.448f)
        curveTo(6.108f, 9.752f, 5.94f, 10.092f, 5.74f, 10.468f)
        curveTo(5.548f, 10.844f, 5.348f, 11.236f, 5.14f, 11.644f)
        curveTo(4.932f, 12.052f, 4.736f, 12.46f, 4.552f, 12.868f)
        curveTo(4.368f, 13.268f, 4.216f, 13.652f, 4.096f, 14.02f)
        curveTo(3.984f, 14.388f, 3.928f, 14.72f, 3.928f, 15.016f)
        curveTo(3.928f, 15.408f, 4.008f, 15.724f, 4.168f, 15.964f)
@egorikftp
Copy link
Member

egorikftp commented Dec 13, 2024

@valeriyo please take a look previous discussion about float precision #71

This function for icon size 24x24 returns following precision "#.###" (playground)

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

2 participants