Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | ram@zedat.fu-berlin.de (Stefan Ram) |
|---|---|
| Newsgroups | rec.puzzles |
| Subject | Re: Musical notes... |
| Date | 2026-05-29 20:59 +0000 |
| Organization | Stefan Ram |
| Message-ID | <ASCII-20260529215641@ram.dialup.fu-berlin.de> (permalink) |
| References | <10v69g9$2k4n9$2@dont-email.me> <1779971454-4353@newsgrouper.org> <89rj1lt723fet58mpotmeloacnrkevb54c@4ax.com> |
Charlie Roberts <croberts@gmail.com> wrote or quoted:
>As a fossil, I cannot think of any other way to do such stuff unless
>there is no option. I prefer it in all my personal documents (my
>thesis was done that way, on an electric typewriter, equations
>and all).
I'm working on a Python program in my leisure to typeset paragraphs
that way.
Example input:
An expression like $x^y$ is called a power.
You can imagine specific values for $x$ and $y$,
as in $3^2$ or $2^3$.
Example output:
y
An expression like x is called a power. You can imagine specific
2 3
values for x and y, as in 3 or 2 .
However, for now, my program only supports digits 0-9, letters
a-z, and exponentiation "^" in formulas. This is a large
project with paragraph wrapping and document formatting that
still needs a lot of work before it is ready for practical use.
Also not ready for most uses is my ASCII-art plotter, but here's
an example output of an ellipse:
....''--'..
..'' `.
..'' \.
..' '
..' ..
..' .'
.' .
.' .
.. .
.' .'
.' ..
.' .
.' .'
.' .'
.' ./
. ./
.' .'
. ..'
. ..
. .'
. ..'
' ..'
. ..'
'. ..'
\. ..''
`.. ...''
'-'''
The client code to draw this ellipse is:
def plot_ellipse(img, slope, W, H, pad_w, pad_h):
cx = pad_w + W // 2
cy = pad_h + H // 2
a, b = W // 4, H // 3
theta = math.radians(30)
coords = []
for k in range(720):
t = 2 * math.pi * k / 720
ex, ey = a * math.cos(t), b * math.sin(t)
rx = ex * math.cos(theta) - ey * math.sin(theta)
ry = ex * math.sin(theta) + ey * math.cos(theta)
px, py = cx + rx, cy - ry
pxi, pyi = int(round(px)), int(round(py))
coords.append((pxi, px, pyi, py))
render_shape(img, slope, coords)
"render_shape" is the call that renders the ellipse in ASCII
while taking into account the slope at every point and choosing an
appropriate character depending on the "sub-pixel" (smaller than a
char) position and the slope ("/" is only used when its slope is
similar to the slope of the curve at this point, for example).
Back to rec.puzzles | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Musical notes... David Entwistle <qnivq.ragjvfgyr@ogvagrearg.pbz> - 2026-05-27 08:20 +0000
Re: Musical notes... James Dow Allen <user4353@newsgrouper.org.invalid> - 2026-05-27 12:58 +0000
Re: Musical notes... David Entwistle <qnivq.ragjvfgyr@ogvagrearg.pbz> - 2026-05-27 18:06 +0000
Re: Musical notes... David Entwistle <qnivq.ragjvfgyr@ogvagrearg.pbz> - 2026-05-28 10:15 +0000
Re: Musical notes... ram@zedat.fu-berlin.de (Stefan Ram) - 2026-05-27 16:25 +0000
Re: Musical notes... James Dow Allen <user4353@newsgrouper.org.invalid> - 2026-05-27 17:10 +0000
Re: Musical notes... James Dow Allen <user4353@newsgrouper.org.invalid> - 2026-05-28 12:30 +0000
Re: Musical notes... HenHanna@NewsGrouper <user4055@newsgrouper.org.invalid> - 2026-05-28 18:21 +0000
Re: Musical notes... msb@vex.net (Mark Brader) - 2026-05-28 18:50 +0000
Re: Musical notes... David Entwistle <qnivq.ragjvfgyr@ogvagrearg.pbz> - 2026-05-29 17:19 +0000
Re: Musical notes... Charlie Roberts <croberts@gmail.com> - 2026-05-29 15:48 -0400
Re: Musical notes... ram@zedat.fu-berlin.de (Stefan Ram) - 2026-05-29 20:59 +0000
Re: Musical notes... James Dow Allen <user4353@newsgrouper.org.invalid> - 2026-05-30 12:07 +0000
Re: Musical notes... James Dow Allen <user4353@newsgrouper.org.invalid> - 2026-05-30 12:25 +0000
Re: Musical notes... James Dow Allen <user4353@newsgrouper.org.invalid> - 2026-05-30 12:33 +0000
Re: Musical notes... ram@zedat.fu-berlin.de (Stefan Ram) - 2026-05-30 12:56 +0000
Re: Musical notes... Mike Terry <news.dead.person.stones@darjeeling.plus.com> - 2026-05-29 22:38 +0100
Re: Musical notes... David Entwistle <qnivq.ragjvfgyr@ogvagrearg.pbz> - 2026-05-30 06:38 +0000
Re: Musical notes... Phil Carmody <pc+usenet@asdf.org> - 2026-06-05 16:41 +0300
Re: Musical notes... James Dow Allen <user4353@newsgrouper.org.invalid> - 2026-06-05 14:54 +0000
csiph-web