Rectangles

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Rectangles

Ralph Boland
I just attempted to draw a rectangle with dimensions  3@3 corner: 9@3.
Nothing gets drawn.  The reason that nothing is drawn is that the width of
the rectangle is 0.  This makes sense for real numbers but for a pixelated
screen or other display medium the dimensions of the rectangle
should be 1 x 7  not  0 x 6!?.  This is 7 pixels needed to draw, not 0.

The same issues occur for the height of the rectangles.

I would think that the way things work would cause all kinds of problems
but since Rectangles are pretty basic, either I am wrong,
or every bit of Squeak code using rectangles has adjusted accordingly.

Please clarify.

How do Java and other languages handle this?

Ralph Boland
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rectangles

Michael Rice
How would that work for horizontal bar charts in which bars with no hits would be displayed the same as bars with a single hit?

On Wed, May 24, 2017 at 11:19 PM, Ralph Boland <[hidden email]> wrote:
I just attempted to draw a rectangle with dimensions  3@3 corner: 9@3.
Nothing gets drawn.  The reason that nothing is drawn is that the width of
the rectangle is 0.  This makes sense for real numbers but for a pixelated
screen or other display medium the dimensions of the rectangle
should be 1 x 7  not  0 x 6!?.  This is 7 pixels needed to draw, not 0.

The same issues occur for the height of the rectangles.

I would think that the way things work would cause all kinds of problems
but since Rectangles are pretty basic, either I am wrong,
or every bit of Squeak code using rectangles has adjusted accordingly.

Please clarify.

How do Java and other languages handle this?

Ralph Boland
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rectangles

Bert Freudenberg
In reply to this post by Ralph Boland
On Thu, May 25, 2017 at 5:19 AM, Ralph Boland <[hidden email]> wrote:
I just attempted to draw a rectangle with dimensions  3@3 corner: 9@3.
Nothing gets drawn.  The reason that nothing is drawn is that the width of
the rectangle is 0.  This makes sense for real numbers but for a pixelated
screen or other display medium the dimensions of the rectangle
should be 1 x 7  not  0 x 6!?.  This is 7 pixels needed to draw, not 0.

The same issues occur for the height of the rectangles.

I would think that the way things work would cause all kinds of problems
but since Rectangles are pretty basic, either I am wrong,
or every bit of Squeak code using rectangles has adjusted accordingly.

Please clarify.

​The coordinates refer to the imaginary lines between pixels. Thus, if you draw a rectangle from x=4 to x=5 its width is 1.​ This is so that if you draw multiple rectangles, they do not overlap (imagine drawing from 5 to 12 and from 12 to 19).
 
How do Java and other languages handle this?

​Same. There's a nice illustration on this page: http://math.hws.edu/~bridgeman/courses/124/f13/doc/paint/paint.html













​- Bert -​


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Loading...