Re: Drawing Arcs



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
.



Relevant Pages

  • Re: Displaying images on form...
    ... The circle is way too small and placed somewhere bottom right on the ... the aspect ratio of the Form, so it should result in a circular shape, at ... because Windows uses the same number of "pixels per logical inch" for both ... the pixels themselves are not necessarily "square" when measured ...
    (microsoft.public.vb.general.discussion)
  • Re: Does the NikonD700 have image stabilization?
    ... That's 736 pixels per second ... It's all about getting sharp images _all_ the time. ... while you don't leave a circle of <7km radius. ... get a sharp shot, while not asking for 1/6000s or shorter. ...
    (rec.photo.digital.slr-systems)
  • Gradient fill an arbitrary shape from inside to outside edge?
    ... Now instead of a central point, there is a central "ring", a circle that sits in the very middle of the actual doughnut - exactly halfway between then outer edge and the inner edge, and pixels are coloured according to their distance from the nearest outside edge and the nearest point on this circle. ... Now, run over the image again - for each pixel, find the nearest edge pixel and the nearest "ridge" pixel. ...
    (comp.graphics.algorithms)
  • Re: Displaying images on form...
    ... The shape of your circle has got nothing to do with the relationship between ... the aspect ratio of the Form, so it should result in a circular shape, at ... because Windows uses the same number of "pixels per logical inch" for both ... the pixels themselves are not necessarily "square" when measured ...
    (microsoft.public.vb.general.discussion)
  • Re: Algorithm to optimize shape cuts on a sheet...
    ... the algorithm for arcs, circle and polygons are not included. ...
    (borland.public.delphi.thirdpartytools.general)