Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet message from alt.ascii-art, 22 Aug 1998.
Re: Ascii utils

Re: Ascii utils

In article <9J1...@shieldwolf.demon.co.uk>, CJRandall wrote:
>[][ something i'd find handy at times, would be a tool/function to draw
>[][ straight and/or curved lines, from any point to any other point, at
>[][ any angle and/or thickness, made entirely from ascii-characters of
>[][ of the alt.ascii-art character set.
>
>                                          |\\  \\  \\  \\  \\./
>       ...............|......../          | \\  \\  \\  \\  \
>       ...............|......./           |  \\  \\  \\  \\./
>       ...............|....../            |\  \\  \\  \\  \
>       ;;.......\.....|...../     .'   .' |\\  \\  \\  \\./
>       ;;;;......\....|..../    .'  .'    | \\  \\  \\-'
>       ;;;;;;.....\...|.../   .' .' _.-'  |  \\ _\`-'
>       ;;;;;;;;....\..|../  .'.'_.-'       \_.-'
>       ;;;;;;;;;;...\.|./ .'_.-'
>                    .\|/_'__________
>                    ../cjr
>                    ./..
>                   ./..

An attempt to line/curve algorithm.

We might consider the partition of a glyph area onto 8 parts

                               /~~0~~\/~~1~~\
                               \_____/\_____/
                               /~~2~~\/~~3~~\
                               \_____/\_____/
                               /~~4~~\/~~5~~\
                               \_____/\_____/
                               /~~6~~\/~~7~~\
                               \_____/\_____/

which are rectangular regions (contrary to this on a picture :).
The size of each particle should not be treated as constant because
of varies of aspect ratio and glyph sizes in various text modes.
But, we should assume that the height of each one is directly one :)
and scaling only the width

                              /| _|~   /~~~~~\
                               |  |_   \_____/

In general each particle should be coded as a bit in char. And the whole
picture space as char*. So we should have the class (i prefer C++ for such a
work). The advantage of such method should be possibility of inherience the
class which could do some other algorithms as zooming, resampling, noising,
denoising etc.

class Picture {
   int length;
   int X;
   int Y;
   unsigned char *table;
   double aspect_ratio;
 public:
   Picture(int x, int y, double ar) { 
	    X = x-1; Y = y-1;
            table = new char[length = (x+1)*(y+1)]; 
            aspect_ratio = ar;
            }
   ~Picture() { delete [] table; }
  
   double GetTrueX() { return double(X); }
   double GetTrueY() { return Y * aspect_ratio; }
   
   void Point(double x, double y);
   void Cls() { for (int i = 0; i < length; i++) table[i] = 0; }
   
   void Print();
};

Constructor Picture::Picture should allocate more memory than it seems to be
possible to give a margin space for a Picture::Print procedure. The generated
picture should be x x y but we should use margin spaces during glyph search.

Method Picture::Point 
We should determine which virtual screen particle should be lit (which bit
should be set) having coords and aspect_ratio.
       
Method Picture::Print
This is the core of all class :) First some remarks.
The line printing glyph should be decoded from Picture::table the
following way (i'll use = as 0 and * as 1)

*=                ==              ==              *=
==      =>  `     ==     =>  .    ==     =>  ,    =*     =>  )
==                **              =*              =*
==                ==              *=              *=

=*                ==              *=
==      =>  '     ==     =>  _    *=     =>  \
==                ==              =*
==                **              =*

**                **              =*
==     =>  ~      **     =>  "    =*     =>  /
==                ==              *=
==                ==              *=

==                ==              =*
**     =>  -      **     =>  =    *=     =>  (
==                **              *=
==                ==              =*


Each 2x4 part of virtual screen should be changed with this method with
some error value i.e. the number of bits which don't match. 
Using margins we should change the starting point (the top left point
of searching area (16 tries) to determine one with the smallest error.

Hope that it helps. So, let's start discussion.

Regards,
  Staszek

Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f996b,53ba859559d3ca50
X-Google-Attributes: gidf996b,public
From: sta...@only.foo.is.portable (Stanislaw Ciszewski)
Subject: Re: Ascii utils
Date: 1998/08/22
Message-ID: <0gED1.1515$1x6...@news.tpnet.pl>#1/1
X-Deja-AN: 383699480
References: <35D...@NOSPAM.solutions.fi> <35d...@news.vossnet.net> <9J1...@shieldwolf.demon.co.uk>
X-Complaints-To: abu...@tpsa.pl
X-Trace: news.tpnet.pl 903811196 195.116.249.35 (Sat, 22 Aug 1998 20:39:56 MET DST)
Organization: TPNET - http://www.tpnet.pl
NNTP-Posting-Date: Sat, 22 Aug 1998 20:39:56 MET DST
Newsgroups: alt.ascii-art
About this message. This message was posted publicly to the newsgroup alt.ascii-art in 1998 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post