Re: ASCII-Art function plotting, advice needed...
From Kjetil Torgrim Homme <kje...@haey.ifi.uio.no>
· alt.ascii-art
· 14 Nov 2002 10:52 · View full thread
· report
[Josef 'Jupp' Schugt]: > > > sin(x) for x ranging from -3 to 3 > > ______________________________________________________________ 1 > > | | _-"""""-_ | > > | | _" -_ | > > | | _" - | > > | | - "_ | > > | | - _ |_ > > | | - - | > > | | " - | > > | | " -| > > | |_" - > > |___________________________________________________________|__ 0 > > | _| | > > - _ | | > > |- _ | | > > | - _ | | > > | " _ | | > > | " - | |_ > > | "_ - | | > > | - _" | | > > | "_ _- | | > > |_________"-_____-"___________|_____________________________|__ -1 > > | ' | ' | ' | ' | ' | ' | > > -3 -2 -1 0 1 2 3 > > The idea of achieving a good vertical resolution is mapping > > [0.000, 0.025) to '_', [0.025, 0.075) to '-', [0.075, 0.100) to '"'. > > (left boundary included, right one excluded that is) - note that the > above plot may slightly differ from this mapping; it was done > manually and to err is human. > > Anybody has a better mapping? Forget about '^' or similar characters > that look very different in different fonts - I can't control the > font that is used. The ideal mapping would take into account not only > the value at a given point but also the left and right neighbor > (which is an approximation for the slope). I think it is better to consider each character a box, and to use the intersection points to select the character. that is, at (-2, -1), you have a box which is _really_ covering the area (-2.05, -0.8) (-1.95, -1.0). to plot that point, consider sin(-2.05) == -0.887 (43.5% into the box) and sin(-1.95) == -0.929 (64.5% into the box) +-----+ 0% | | 20% * | 40% | * 60% | | 80% +-----+ 100% in addition to these percentages, the intersection on one side can happen in a box above or below it. let's call these cases just A and B. now you need to map these into characters. A B | B A | B 80 , 20 A ' 0 100 \ 100 0 / 100 100 _ B 100 _ 100 B _ 0 0 " 0 A " A 0 " 50 50 - the above values should _really_ be ranges, of course. Kjetil T.
Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f996b,8ae611e029f9880b X-Google-Attributes: gidf996b,public X-Google-ArrivalTime: 2002-11-14 02:52:23 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!ra.nrl.navy.mil!dca6-feed2.news.algx.net!jfk3-feed1.news.algx.net!allegiance!newspeer.monmouth.com!uninett.no!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail From: Kjetil Torgrim Homme <kje...@haey.ifi.uio.no> Newsgroups: alt.ascii-art Subject: Re: ASCII-Art function plotting, advice needed... Date: 14 Nov 2002 11:52:22 +0100 Organization: Dept. of Informatics, Univ. of Oslo, Norway Lines: 80 Message-ID: <1rv...@tiu.ifi.uio.no> References: <slr...@jupp.8m.com> NNTP-Posting-Host: tiu.ifi.uio.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: maud.ifi.uio.no 1037271142 22418 129.240.65.210 (14 Nov 2002 10:52:22 GMT) X-Complaints-To: abu...@ifi.uio.no NNTP-Posting-Date: 14 Nov 2002 10:52:22 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com alt.ascii-art:20657
Related ASCII art in the Gallery
Explore these categories from our collection of 11,000+ artworks:
_ _ (o)(o)--. \../ ( )hjw m\/m--m'`--.
_ _
/` \/ `\_ _
\ /` \/ `\
'. .\ /
\/ '. .'
\/jgs __ . . __ (o.\ \/ /.o) \__\/\/__/ /O /==\ O\ (;O/ \/ \O;)
_______ |.-----.| || jgs || ||_ _|| `--)-(--` __[=== o]___ |:::::::::::|\ `-=========-`()
,sSSs ,SSSS_/ ,_ sS/`))\// sS//|_(_/ _, SS\\\ `""-.-'` / sSS` jgs-==-'`'-._\
___________ | _______ | | | | | | | | | | | | | | |_______| | |___________|
Make your own ASCII art
Turn images, text or 3D into ASCII, or draw your own – right in your browser.
About this message.
This message was posted publicly to the newsgroup
alt.ascii-art
in 2002 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.