Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Trouble - floor() BUG? or.... merely my faults?
Date: Tue, 17 Jun 2008 15:39:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 59
Message-ID: <g38lql$e9m$1@fred.mathworks.com>
References: <g37urn$4eh$1@fred.mathworks.com> <g383c1$92q$1@fred.mathworks.com> <g38i0q$gk$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1213717141 14646 172.30.248.37 (17 Jun 2008 15:39:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 17 Jun 2008 15:39:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 791003
Xref: news.mathworks.com comp.soft-sys.matlab:474267



"ken " <ken4aver@yahoo.com.tw> wrote in message 
<g38i0q$gk$1@fred.mathworks.com>...
> "David " <dave@bigcompany.com> wrote in message <g383c1
> $92q$1@fred.mathworks.com>...
> 
> > with the set of parameters giving you the problem this 
is 
> > where your error really is:
> >         y=m*(x_prime+1)+param1y; %CY(x_prime+1);
> >         y_prime=floor(y);
> > 
> > the calculation works out that 
y=3.799999999999999e+001 
> > which floor converts to 37... so it never gets past 
that 
> > point, eventually it probably runs out of memory as 
its 
> > stuck in an infinite loop building the array.  overall 
> the 
> > code looks way over complicated for drawing a line, 
and 
> as 
> > too many chances for things like this to throw it 
off.  
> > just what are you trying to do anyway?
> > 
> 
> :P...I'd notice about that and more explicitly state 
> problems.
> 
> And thanks, David.
> I have done a Computed Tomography simulation code few 
weeks 
> ago, and have encountered this problem....it rarely 
happens 
> and happened.
> 
> Any idea to rectify such embarrassment or anyone knows 
any 
> related function in MATLAB could do line-pixel mapping? 
Or 
> to look for Line-drawing algorithms?
> 
> Regards and thanks in advance.
> 
> 
> 

the matlab file exchange is a good place to start.  here 
are a couple along those lines.
http://www.mathworks.com/matlabcentral/fileexchange/loadFil
e.do?objectId=17658&objectType=File
http://www.mathworks.com/matlabcentral/fileexchange/loadFil
e.do?objectId=13397&objectType=file

and there are probably more there... and google sometimes 
will find good stuff also.