Re: Drawing lines of variable widths
- From: Alan Murphy <gpsu.co.uk@xxxxxxxxxxx>
- Date: Tue, 11 Jul 2006 20:47:52 +0100
The demonstration program only works for lines in the first octant.
See the comment
"This version of the demo only supports the drawing of lines in the
first octant - where (X2-X1)>(Y2-Y1)>0. Drawing lines in other octants
is obtained by defining the 4 types of moves required by the loops."
In your examples, (X2-X1)<0 and so it does not work.
I originally coded the algorithm in 1976, but when I published the web
pages in 1999, I did not get round to extending the example algorithm
for the other octants. This is left as an exercise for the reader.
Alan Murphy
On 11 Jul 2006 08:58:53 -0700, george.lutz@xxxxxxxxx wrote:
Alan Murphy wrote:
On 10 Jul 2006 16:27:13 -0700, george.lutz@xxxxxxxxx wrote:
Is there an algorithm available to draw lines of variable thickness
(using a bare bones graphics library - not GDI, etc)? I can draws
lines of single thickness. I am looking for something similiar to the
GDI functionality that creates a pen of a certain thickness then draws
a line using the pen.
This is an easy thing to do when I want to draw a line of zero or no
slope (i just draw parallel lines using DrawLine() of course), however
when i need to draw thicker lines of variable slope, it becomes quite
complex. I assume this has been done before though.
Thank you for any advice!
George
You may like to look at an algorithm I invented in 1976. This is
published at:
http://homepages.enterprise.net/murphy/thickline/index.html
The algorithm supports non-integer pen thicknesses. The example on the
page, show how the pen thickness can be varied as a function of the
length drawn. (i.e. a tapered line).
As I am now retired and no longer work in this field I am not able to
answer questions on modern implementations, but I gather that this has
been done by others.
Alan Murphy
Mr. Murphy,
I have actually experimented with your algorithm already as it is the
only such algorithm I have been able to find. It seems to work for
about 80% of the lines I've drawn, however the problem I have found is
that certain lines are not drawing correctly. For example, take the 2
connecting lines below here, drawn at a width of 3 (or 4 or 5). The
lines do not appear to be the same widths.
POINT p0 = {159,25};
POINT p1 = {107,207};
POINT p0a = {107,207};
POINT p1a = {0,319};
Have you heard of such an issue? Are you aware of any modifications to
the posted algorithm?
Thank you very much for any advice, it is much appreciated.
.
- Follow-Ups:
- Re: Drawing lines of variable widths
- From: george . lutz
- Re: Drawing lines of variable widths
- References:
- Drawing lines of variable widths
- From: george . lutz
- Re: Drawing lines of variable widths
- From: Alan Murphy
- Re: Drawing lines of variable widths
- From: george . lutz
- Drawing lines of variable widths
- Prev by Date: Re: Drawing lines of variable widths
- Next by Date: Re: Drawing lines of variable widths
- Previous by thread: Re: Drawing lines of variable widths
- Next by thread: Re: Drawing lines of variable widths
- Index(es):
Relevant Pages
|