On 4/19/2020 9:02 PM, Jeong Dal wrote:
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.

In what sense? Runtime? Even moving the definitions doesn't really save cpu cycles. MP runtime is normally not the bottleneck in a run.

\startMPextensions
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;
\stopMPextensions

Is there a way to draw the base figure once, and draw the points only at each frame?
I guess you could stack them on top of a base background image but I wonder if it's worth the trouble.

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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 via email to