From: Mojca Miklavec <mojca.miklavec@guest.arnes.si>
Subject: Re: shading in meta[post/play] & PDF
Date: Fri, 21 Jan 2005 00:47:37 +0100 [thread overview]
Message-ID: <41F04319.2070402@guest.arnes.si> (raw)
In-Reply-To: <41EE4903.4060705@wxs.nl>
Hans Hagen wrote:
> Mojca Miklavec wrote:
>
>> How can I make shading inside metapost(play) to produce exactly what's
>> in the attached picture (smooth shades). Or more generally: how can I
>> "hardcode" some PS/PDF code in .mp, not (yet) supported by
>> metapost(play)?
>
>
> certain kind of native level 2 shaded can be done with the metafun
> macros (circular and linear vector based)
>
> a couple of years ago mathew baker and i played with more advanced
> features using functions and such but i need to locate that code;
>
> if you're willing to figure out what (in pdf) functionality is needed i
> can extend the current metapost shading handler with a few more
> alternatives [the function based ones, since that's what you're looking
> for])
I'm not sure if I understood the question correctly (about what should I
figure out).
I would like to draw a sphere (possibly with different colors on
different points of the sphere; which would then be interpolated across
the whole surface).
Problem description:
I have a computer program, which carries the data about the grid points
on a sphere (possibly with different colors defined in these points) and
how the points are connected with each other to form a grid. I would
take these triangles (or quadrilaterals), draw them transformed on the
plane (with curves, not with straight lines) and fill them with the
appropriate shading pattern (colors defined in corners of the triangles
(darker according to normal vector) simply interpolated between the
three points). Yet another possibility would probably be to use
function-based shading and define a function which knows how the points
have to be shaded on the sphere, but the latter seems more complicated
and less universal.
Problem reduction:
Fill a mp closed path with any more complex shading.
So I would probably need Type 6 or 7 shading (Type 4 would be OK as the
picture can be clipped within metapost, so that the resulting sphere
borders are not composed of straight lines; the articles on
http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/ which
inspired me to do something so crazy actually use Type 4 shading). Type
one is probably the most general one, so it should be OK too, just
complicated to do.
However: I'm not sure if, say, a (sampled) function to be passed to PDF
can be specified in metapost elegantly.
Page 746 of PDF Reference, version 1.6 also defines an interesting new
feature: 3D objects (3D Artwork as they call it), but I haven't found
anything else about that.
In dvipdfm there's an example of using:
\special{pdf: bt rotate 90 xscale 2.0 }
These lines are to be used in TeX. MetaPost also knows a "special"
command, I just don't know how to use it. (This is probably the
"communication channel" to PDF when trying to implement some more exotic
shadings.)
I glimpsed the mp-spec.mp file, but I didn't yet understand how the
parameters are passed to PDF.
> [more a context mailing list issue than a metapost list issue]
So I left the metapost group out. Actually, 90% on the people here
probably think I posted that to the wrong group anyway (in the sense of
"Are you sure you didn't want to post that question to the 3D studio max
mailing list?" :) The example above is probably not the most descriptive
one, but having the possibility to add some more advanced shading
patterns would be great.
Thank you,
Mojca
next prev parent reply other threads:[~2005-01-20 23:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-15 5:16 Mojca Miklavec
2005-01-15 21:04 ` [metapost] " Laurence Finston
2005-01-19 10:00 ` Mojca Miklavec
2005-01-19 10:59 ` Laurence Finston
2005-01-19 11:48 ` Hans Hagen
2005-01-20 23:47 ` Mojca Miklavec [this message]
2005-01-21 20:55 ` h h extern
2005-01-22 1:36 ` Mojca Miklavec
2005-01-15 22:02 ` [metapost] " Laurence Finston
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41F04319.2070402@guest.arnes.si \
--to=mojca.miklavec@guest.arnes.si \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).