ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Patrick Gundlach <pg@levana.de>
Subject: Tangent vector
Date: Sat, 29 Sep 2001 23:24:16 +0200	[thread overview]
Message-ID: <01092923241600.09086@levana> (raw)
In-Reply-To: <3.0.5.32.20010926144726.008f2360@mail.northcoast.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 1907 bytes --]

Hallo David,

> In the second image in this file, I am disappointed to find that the
> vector doesn't look tangent to the path at the tip of the position
> vector.
[...]

OK, there are several issues here, that might be confusing.

> %initialize scale
>  numeric u; 6u=3in;
>
> %draw coordinate axes

[...] 

> %calculate the velocity vector
>  numeric t;
>  t:=directiontime (1u,2u) of p;
wrong: directiontime looks at the path p and tries to find a slope of 
(1u,2u). Since it cannot find one, t gets -1 (check with show t).

>  pair d;
>  d:=direction t of p;
since t = -1 it looks at the first point and finds the direction there. 

>  drawarrow ((0,0)--d) scaled u shifted (1u,2u);
This is messy, since d has the correct correct direction but a "somewhat 
arbitrary" magnitude. See the Metapost manual p. 28.

>  p:=p scaled u;
If you do some calculations with path p, you have to scale it before doing 
these calculations!

So here is my solution (tested with context/metafun)

----------------------------------
%initialize scale
 numeric u; 6u=3in;

%draw coordinate axes
 drawdblarrow (-1u,0)--(5u,0);
 label.rt(btex $x$ etex, (5u,0));
 drawdblarrow (0,-1u)--(0,3u);
 label.top(btex $y$ etex, (0,3u));

%path
 path p;
 p:=(-1,1)...(1,2)...(5,2.5);
 p:=p scaled u;
%position vector
 drawarrow (0,0)--(1u,2u) withcolor red;
 label.lrt(btex ${\bf r}(t)$ etex, 0.5[(0,0),(1u,2u)]);
 dotlabel.ulft(btex $(x(t),y(t))$ etex, (1u,2u));

%calculate the velocity vector
 numeric t;
 % at what time does my point intersect w/ the path?
 (t,whatever) = p intersectiontimes ((1u,-infinity)--(1u,infinity));

 pair d;
 d:=direction t of p;
 %warning! d now has the correct direction but not!! magnitude

 drawarrow (origin -- ((2u,0) rotated angle d)) 
         shifted (1u,2u) 
         withcolor green;

 draw p withcolor blue;
---------------------------------------

-- 
Viele Grüße, 

    Patrick Gundlach


  parent reply	other threads:[~2001-09-29 21:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-26 21:47 David Arnold
2001-09-29 17:37 ` Hans Hagen
2001-09-29 21:24 ` Patrick Gundlach [this message]
2001-09-30 20:00   ` Hans Hagen

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=01092923241600.09086@levana \
    --to=pg@levana.de \
    /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).