Anonymous | Login | 04-13-2021 19:20 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0002126 | [Squeak] Graphics | minor | always | 10-25-05 20:46 | 02-16-06 10:01 | ||||
Reporter | BGaertner | View Status | public | ||||||
Assigned To | andreas | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.9 | ||||||
Summary | 0002126: Rectangle>>areasOutside: has a bug | ||||||||
Description |
The instance method areasOutside: of Rectangle has a subtle bug that can cause a result with lots of rectangles of height zero. To see the problem, you can evaluate this piece of code: | frame rects visibleBackground cnt | cnt := 0. visibleBackground := [:f :rc | | visibleAreas | visibleAreas := Array with: f. rc do: [:rect | | remnants | remnants := OrderedCollection new. visibleAreas do: [:a | remnants addAll: (a areasOutside: rect)]. visibleAreas := remnants. cnt := cnt + 1. Transcript show: cnt printString; show: ' '; show: visibleAreas size printString; cr. ]. visibleAreas ]. frame := 0@0 extent: 300@300. /> rects := OrderedCollection new: 80. 0 to: 9 do: [:i | 0 to: 7 do: [:j | rects add: (i@j * 20 extent: 10@10) ]]. ( visibleBackground value: frame value: rects) size ----------------- Here we have a large rectangle (frame) and 80 small rectangles that are placed on the large rectangle. The block is a piece of code that computes the part of the large rectangle that is not covered by small rects. replace the last statement of the code above with (( visibleBackground value: frame value: rects) reject: [:r | r area = 0] ) size to see that most of the rectangles have no area. The many useless rectangles of height zero are created becaue areasOutside: uses a wrong test for intersection. The test ignores the fact that the bottom line and the right border line of a rectangle are not part of the rectangle. Attached you find 1. a proposed fix (Rect-areasOutside-bg.1.cs) 2. some additional tests for class Rectangle. (RectangleAdditionalTests.2.cs) |
||||||||
Additional Information | The bug is also present in earlier versions of Squeak. | ||||||||
Attached Files |
![]() ![]() |
||||||||
|
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
56 total queries executed. 37 unique queries executed. |