ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Circuit diagrams
Date: Tue, 22 Jun 1999 00:02:10 +0200	[thread overview]
Message-ID: <376EB662.36594B1B@wxs.nl> (raw)
In-Reply-To: <3.0.5.32.19990621095557.00a972b0@mail.northcoast.com>

David Arnold wrote:
> 
> Hans,
> 
> Interesting. How would you draw a mass hanging on a spring in Metapost?
> Have you done this before? Sample code?

Run the next mp file and take a look in GSview (nb, even fig numbers).
It need a bit cleaning up, but it's not that hard. When I find some idle
moment, I'll see if I can work it out as an example for the manual. 

input mp-tool ;

def animate (expr weight, spring, position) =
  h := spring ;
  w := h/8 ;
  pickup pencircle scaled 2.5 ;
  fill
    fullcircle scaled weight shifted (0,-.5weight)
    withcolor .7white ;
  draw
    (( 0,  0)--( 0, 20)--
     (-w, 30)--(+w, 40)--
     (-w, 50)--(+w, 60)--
     (-w, 70)--(+w, 80)--
     (-w, 90)--( 0,100)--
     ( 0,110))
    xscaled position ;
  pickup pencircle scaled 5 ;
  drawdot (0,0) ;
enddef ;

for i=.2 step .2 until 1 :
  beginfig(i*10) ;
    animate (40,100,i) ;
  endfig ;
endfor ;

end .

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


      parent reply	other threads:[~1999-06-21 22:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-20 18:46 David Arnold
1999-06-21 10:09 ` Taco Hoekwater
1999-06-21 11:28 ` Hans Hagen
     [not found] ` <3.0.5.32.19990621095557.00a972b0@mail.northcoast.com>
1999-06-21 22:02   ` Hans Hagen [this message]

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=376EB662.36594B1B@wxs.nl \
    --to=pragma@wxs.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).