Re: Drawing Arcs
- From: Yann <kdo4973@xxxxxxxxx>
- Date: Sat, 9 Aug 2008 17:07:00 -0700 (PDT)
now, the breasenham algo only works by UP/DOWN or LEFT/RIGHT moves...
if you want to move UP, just increate D1 by the length of line (assuming
line lenght is in R0: AD1EX CR0EX.A A+C.A AD1EX CR0EX.A ) and you are done!
OK, now i understand why you are not using circle symetry :
you need the previous point and its nibble address to determine the
next one.
That's indeed very clever, good performances, low complexity, quite a
dream.
So be sure that i will make use of it for the next development phase.
I've been using the last few hours at testing a previously mentionned
idea : dynamically generate the code for multiplication during
initialisation, and the results are pretty interesting.
Actually, the funny thing is that now the multiplication code is so
fast (28 cycles for a normal 131 pixels screen) that it costs less
than the jump statements around it (48 cycles).
I couldn't find anything faster (& simpler) than :
A=D0 [16] % this in fact is ==> AD0EX D0=A
APCEX [16]
(... here is the dynamically created code ending with : )
APCEX [16] or PC=A [16]
Well anyway, this was interesting to try, and maybe such a concept
could be reused later.
New performance numbers follows :
FastCircle V2.5 on HP48SX (422 Bytes)
30 pixels (65,32,30) ==> 76ms
60 pixels (30,-10,60) ==> 88ms
200 pixels (60,215,200)==> 184ms
At this level of performance, i was wondering if the header was
becoming a bottleneck,
so i released FastCircle PureCode, for programmers, in order to find
out, and here are the results :
FastCircle PureCode v2.5 on HP48SX (299.5 Bytes)
30 pixels (65,32,30) ==> 56ms
60 pixels (30,-10,60) ==> 66ms
200 pixels (60,215,200)==> 161ms
So it seems that the header does actually cost a fixed 20ms time,
which is not unexpected.
You can find the new binaries for all HP platforms at this address :
http://phantasie.tonempire.net/utilitaires-f7/fastcircle-t58.htm
I believe this is the last release for full circle drawing, as it
seems to be a good enough base to work on the real objective of this
thread, Arcs drawing.
here is the code in ASM for an arc.
this is a source from a debug4x project, so it should compile readely if you
create a project and add this file in (make the project a library)...
Thanks Cyrille. The sources codes you provided do indeed compile fine,
both for Arcs & Circles.
But for some reason, i'm unable to get any "drawn pixel" out of it.
Note that it does not crash either.
I've followed instructions to provide inputs directly in registers as
requested
% input: D0: @ grob %
% Aa: Centre x %
% Ba: Centre y %
% Ca: Rayon %
% R0a: 360-AngleStart*8.93608577019 90°->804%
% R1a: 360-AngleEnd*8.93608577019 %
but to no avail, neither for Arc nor for Circle.
Furthermore, it seems the header you provided with the second code is
intentionnally wiping out input data with values of its own.
Therefore, i was expecting a fixed output from running the code, but
got a blank screen.
It could be this is because i'm testing on HP48 S/G, and the results
might be different on HP49 ?
I finally have some results from running your program on my 50g
Thanks Jacob for taking the time to test it on your calc. Indeed, this
is encouraging.
I believe i will get rid of the "one pixel approximation" in the next
version, thanks to your explanations on algorithm and thanks to
Cyrille too.
Regards
.
- Follow-Ups:
- Re: Drawing Arcs
- From: cyrille de brebisson
- Re: Drawing Arcs
- References:
- Re: Drawing Arcs
- From: Claudio Lapilli
- Re: Drawing Arcs
- From: Yann
- Re: Drawing Arcs
- From: Yann
- Re: Drawing Arcs
- From: Yann
- Re: Drawing Arcs
- From: cyrille de brebisson
- Re: Drawing Arcs
- Prev by Date: Re: Binomial Expansion
- Next by Date: Re: Binomial Expansion
- Previous by thread: Re: Drawing Arcs
- Next by thread: Re: Drawing Arcs
- Index(es):
Relevant Pages
|