ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jeong Dal <haksan@me.com>
To: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: animation using \startuseMPgraphic
Date: Mon, 20 Apr 2020 04:02:19 +0900	[thread overview]
Message-ID: <B05709F8-C4CF-4571-A463-5BB26E4F5B3E@me.com> (raw)
In-Reply-To: <E56A8B5D-FFE7-43D7-B1D6-303BB8E3FEFF@me.com>


[-- Attachment #1.1: Type: text/plain, Size: 1311 bytes --]

Dear Wolfgang,

I’d like to ask you one more.

To make an animation, almost same graphics are drawn repeatedly.
In my code, for example,
The base figure(two circles, line, boundingbox) is fixed and only points are moved.
But it draws the base figure every time and it is not inefficient.

Is there a way to draw the base figure once, and draw the points only at each frame?

Thank you.
Best regards,

Dalyoung

\startuseMPgraphic{inversionPoint}{n}
vardef findPointD(expr C, Q, r) = 
    numeric dist, ang;
    pair X, Y;
    dist := r**2/sqrt((xpart Q - xpart C)**2 + (ypart Q - ypart C)**2);
    ang := angle(Q - C);
    Y := C + dir(ang)*dist;
    Y
enddef;

numeric radius, now, move;
pair A,B,C,P,Q;
path p,q;
   radius := 2cm;
   C := origin;
   p := fullcircle scaled (2*radius);
   z[1] = point 6 of p;
   z[2] = point .8 of p;

   q := (1.5*z1 - .5*z2) -- (-.5z1 + 1.5*z2);
   %q := fullcircle scaled radius shifted (2cm, 1cm);
   draw p;
   draw q; 

% end of base figure
% draw points

    move := 0.1;
    now := move*\MPvar{n};
    P := point now along q;
    Q := findPointD(C, P, radius);
    drawdot P;
    drawdot Q withcolor .625red;
    dotlabel.lft(textext("P"),P);
    dotlabel.rt(textext("Q"),Q) withcolor .625red;
\stopuseMPgraphic


[-- Attachment #1.2: Type: text/html, Size: 18292 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-04-19 19:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1.1587204001.32518.ntg-context@ntg.nl>
2020-04-19  5:08 ` Jeong Dal
2020-04-19  7:19   ` Wolfgang Schuster
2020-04-19 11:18     ` Jeong Dal
2020-04-19 19:02       ` Jeong Dal [this message]
2020-04-19 20:57         ` Hans Hagen
2020-04-19 22:49       ` Jeong Dal
2020-04-19 16:32   ` Aditya Mahajan
     [not found] <mailman.166.1587373273.1194.ntg-context@ntg.nl>
2020-04-20 14:40 ` Jeong Dal
2020-04-20 17:19   ` Hans Hagen
2020-04-21 11:10     ` Jeong Dal

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=B05709F8-C4CF-4571-A463-5BB26E4F5B3E@me.com \
    --to=haksan@me.com \
    --cc=ntg-context@ntg.nl \
    --cc=wolfgang.schuster.lists@gmail.com \
    /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).