Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!news.stack.nl!.POSTED!not-for-mail From: Willem Newsgroups: alt.comp.lang.borland-delphi,comp.lang.c,comp.lang.java.programmer Subject: Re: names for parameters of ranges (was: ...) Date: Wed, 23 May 2012 09:43:36 +0000 (UTC) Organization: Stack Usenet News Service Lines: 66 Message-ID: References: <29308868.1994.1337265697084.JavaMail.geo-discussion-forums@pbcuc6> <84131$4fb54067$5419acc3$20839@cache90.multikabel.net> <1bd38$4fb91376$5419acc3$14683@cache80.multikabel.net> NNTP-Posting-Host: toad.stack.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: mud.stack.nl 1337766216 67303 2001:610:1108:5010::135 (23 May 2012 09:43:36 GMT) X-Complaints-To: abuse@stack.nl NNTP-Posting-Date: Wed, 23 May 2012 09:43:36 +0000 (UTC) User-Agent: slrn/0.9.9p1 (FreeBSD) Xref: csiph.com comp.lang.c:21228 comp.lang.java.programmer:14750 Stefan Ram wrote: ) Yes. But it is not only Java, it also is English used for ) mnemonic identifiers. And in English, phrases like ?from ) index? and ?to index? have a meaning. ) ) So, if one would name a parameter ?maximum? and then specify ) this to mean the maximum plus 1, it would be a bad name. ) ) For example, we can read: ) ) ?The left and right edges of the rectangle are at x and x + width. ) The top and bottom edges are at y and y + height.? ) ) http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html#drawRect(int, int, int, int) ) ) Now, let's take this ?width? to be 1, and x to be 3, ) y = 5, height = 3, we have the following rectangle ) drawn according to the documentation: ) ) 9 ) 8 ## ) 7 ## ) 6 ## ) 5 ## ) 4 ) 3 ) 2 ) 1 ) 0123456789 ) ) When one looks at this rectangle, would one say that its ) width was 1 and its height was 3? Yet this is the way the ) parameters are named! One would, if one were to define a 'line' to be centered on the pixel. You seem to define it to be on the edge of the pixel. Both are plausible. Look at this, for example: 10 9 +---+---+ 8 | | | 7 | | | 6 | | | 5 +---+---+ 4 | | | 3 | | | 2 | | | 1 +---+---+ 0 0123456789 Is it four 4x4 rectangles that together form an 8x8 rectangle, or is it four 5x5 rectangles that form a 9x9 rectangle? The latter would be odd, given that 5+5=10 (and not 9). And once you get into transforming coordinates, anti-aliasing and whatnot, your definition falls flat on its face. SaSW, Willem -- Disclaimer: I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged or something.. No I'm not paranoid. You all think I'm paranoid, don't you ! #EOT