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

Precision bug in alignment tool


Recommended Posts

This bug exist in the 1.10 version. I have not tried the 1.10.1 version yet. This bug is with the alignment tool, but particularly the icon in the toolbar. Aligning via the drop down menu gives a different result. Basically the toolbar alignment precision is thrown off when a shape is rotated. Just to preface, this problem is easiest to view if you work with 4 digits after the decimal (This is the way I typically work because precision is needed for what I do). This is especially noticeable when the shape is equal on all sides. I created a document with 12 circles. The middle circles in the red and blue columns of circles are rotated; one 15 degrees and the other 30 degrees. Other than that, each circle is exactly the same at 100x100 pixels. Using the vertical alignment tool, if I set the column of circles to distribute by an even space of 0 it should result in a column of circles that is 100x400 pixels. This is exactly what I get in the gray column because none of the circles are rotated in it. But, for the blue and the red, I end up with columns that are 100.0192x400.0207 each.

 

Now, let's take this a step further and manually move the circles so that the spacing is uneven (vertically). Then move the bottom circles so that the center of the bottom circles is at the 350 pixel position. Now if you select all the gray circles and then vertically align via the tool bar it will result in a 100x400 pixels column of circles with each circle exactly 100 pixels apart from each other. If you do the same with the red column it will result in each circle in the red column not being evenly distributed. But, if you align the blue column via the menu distribute option, it will be completely evenly aligned with each circle being exactly 100 pixels a part from each other. Doing it with the toolbar is always imprecise. I assume this is a bug.SharedScreenshot.thumb.jpg.bd101e682dee9797060a53317c342d01.jpg

 

With 4 objects it isn't a big deal  because it off by such a minute amount, but if there are several then it begins to compound the issue until it is clearly off. I have attached the circle project mentioned above untitled.afdesign. Below is an example of what it looks like after the distribution bug compounds over many elements. There is a visible gap between the cog outline and the purple ring due to a misalignment done by the bad spacing.2.thumb.jpg.8bc0a111498d20d8c78fb11e6dacf451.jpg

Link to comment
Share on other sites

I raised an similar issue about rotated objects several month ago, in Photo.

As you object have a size with even number of pixels, when you rotate them with the middle anchor point, you get unavailable rounding issues regarding the position. To be able to rotate objects on the middle anchor point, you should use odd pixel size.

Otherwise, anti-aliasing could lead to fractional positions.

If the number of objects stays within reasonable limits, as a workaround you could other alignment methods, like grid or  rulers and snapping, or rectangular helper shapes (unrotated).

You may even nest problematic rotated shapes into rectangular shapes, to allow perfect alignment / distribution.

Edited by NotMyFault

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

Actually I think this might be the potential root cause:

  1. create a circle (ellipse tool with fill color, e.g. blue) on integer position with integer size (100 px)
  2. Select move tool
  3. select anchor point middle. Check that it has integer value (no fractional digits). If not, move to integer position.
  4. rotate stepwise using transform panel.
  5. Check rendering of edge pixels: depending on rotation value, rendering changes.
  6. Set anti-aliasing to forced off. Repeat step 5 and see identical results.
  7. Increase size to odd integer 101px. Repeat step 5 and see identical results. 

Conclusion: A rotated circle renders differently depending on rotation at edge pixels, anti-aliasing on or off. This is totally unexpected as a circle should be rotation invariant.

The issue raised by abject39 might be related or independent.

Tested on iPad with Photo (to have control over anti-aliasing)

Note: video shows no issue for even circle size - this is due to having selected wrong zoom level and crop for video.  Issue can be seen at about 45 degree position of circle, try yourself. 

Edited by NotMyFault
Added video

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

2 hours ago, NotMyFault said:

Conclusion: A rotated circle renders differently depending on rotation at edge pixels, anti-aliasing on or off. This is totally unexpected as a circle should be rotation invariant

But remember that the Affinity applications do not create geometrically precise circles. They only create a Bezier approximations of circles.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

6 hours ago, walt.farrell said:

But remember that the Affinity applications do not create geometrically precise circles. They only create a Bezier approximations of circles.

Good point, according to wikipedia 

https://en.m.wikipedia.org/wiki/Bézier_curve

  • Some curves that seem simple, such as the circle, cannot be described exactly by a Bézier or piecewise Bézier curve; though a four-piece cubic Bézier curve can approximate a circle (see composite Bézier curve), with a maximum radial error of less than one part in a thousand, when each inner control point (or offline point) is the distance \textstyle {\frac {4\left({\sqrt {2}}-1\right)}{3}} horizontally or vertically from an outer control point on a unit circle. More generally, an n-piece cubic Bézier curve can approximate a circle, when each inner control point is the distance \textstyle {\frac {4}{3}}\tan(t/4) from an outer control point on a unit circle, where t is 360/n degrees, and n > 2.

I don’t know which types (cubic) Affinity uses, but the radial error should far less vs what is visible. If you reduce the circle diameter to 15px, the edge color change is strong visible. 

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

  • Staff
On 8/28/2021 at 4:00 PM, abject39 said:

Surprised to not hear anything back on this. Maybe my description was entirely too complicated to understand. I can create a video of the issue if needed.

Sorry for the delay in responding, however we cannot always reply immediately depending on the posts that need responding do.

It is also worth being aware of the tips we have put out for reporting bugs to us. Providing a clear step by step recipe of exactly what you're doing and seeing vs what you expect makes issues much easier to understand and interpret for every one - as opposed to reading a big wall of text. This is further helped by attaching video (like you suggested) also showing the steps you're taking to avoid any confusion of what you're doing.

I will get your issue reported to development to be investigated. However as Walt suggested it could well be down to the imprecise Bézier curves.

Thanks

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.