Mantis - Squeak
Viewing Issue Advanced Details
6991 Balloon minor always 03-24-08 10:30 03-26-08 01:41
assigned 3.10  
0006991: Fix: Rendering artifacts when using Bezier shapes (MIT license)
i spent a few hours implementing new morph (BezierMorph) , partly to
see how balloon draws bezier shapes, partly to be able to edit all
cubic bezier parameters.

What i found that at some specific point it produces a visual
artifacts by infinitely extending a single horizontal lines.

I found the cause of problem: It's in method Bezier3Segment>>asBezier2Points:.
When cubic segment being split to multiple quadratic ones, the last quadratic segment point is calculated by conversion, instead of taking already existing end point of cubic segment.
So, in case when shape is represented as a linked list of cubic segments the condition that end point of previous segment should match the starting point of next segment is not always fulfilled due to conversion inaccuracy.
This leads to appearing of a little gaps between segment endpoints and engine, while rendering, fills gap with infinite horizontal line in right direction from gap location.

child of 0006511new  Mother of all Morphic Graphical off-by-one/fencepost -error reports. 
 Bezier3Segment-6991.cs [^] (823 bytes) 03-24-08 10:31 [^] (2,756 bytes) 03-24-08 10:33
 Bezier3Segment-fix.6991-2.cs [^] (1,805 bytes) 03-25-08 06:37

03-24-08 10:33   
In additional attachment you can find a BezierMorph class using which you can reproduce the problem.
03-25-08 03:14   
Hi Sig,

This sounds like a great bug find and repair. Could you include a sunit test to prove the patch.
It needs to fail before the patch is applied and pass afterwards.

I think it will be important in this case. There are a lot of rounding problems in the balloon stuff. Which means a lot of patches as they are fixed. When that happens, tests will help prevent loosing your fix.

Yours in service and curiosity, --Jerome Peace
03-25-08 06:41   
In updated changeset you can find both fix and test case.

It fails without fix, and passes after it.
But take in account, that different CPUs/platforms may compute floating points differently, so my test case may not fail with 100% guarantee with old code.
But, of course, there is 100% guarantee that it can't fail after fix.
03-26-08 01:41   
Hi Sig,

>In updated changeset you can find both fix and test case.

Cool. I wrote my note before playing with patch.

Even if it doesn't work in all platforms it helps.

Partial progress always counts.

Cheers -Jer