Mojca, I've used clip currentpicture to cpath before, then saved the result, draw the grid, draw the axes, then draw the saved clipped picture. But, you're right, I can't use drawdblarrow then. In our classes, the drawdblarrow is important, having the same meaning as the ellipsis in 1, 3, 5, 7, 9, ..., that is, "etc." In the case of a parabola opening upward, the arrow on the right half would indicate that the graph continues opening upward and to the right indefinitely. This is an important distinction from say a line segment that "stops" at one end, especially when asked to determine the domain and range of a function from its graph. The clipping path is a huge convenience for an instructor crafting plots for an exam, activity, or lesson. Otherwise, the instructor would have to calculate the points where the graph leaves the bounding box (less painful if you use Matlab, Maple, or Mathematica, or a graphing calculator), a time consuming task. I am not so concerned about a plot that might lie entirely outside the clipping window. That just requires, as on the graphing calculator, that one adjust the window (different xmin, xmax, xscl, ymin, ymax, and yscl). I just need to be able to clip the plot and retain the part that lies inside the clipping window, then use drawdblarrow on the part that remains. My clip routine won't (cutbefore, reverse, cutbefore) won't work on something like y=sqrt(3-x) for two reasons: 1. A domain problem (easily solved by adjusting the drawfcn command to include two more parameters: beginx, endx. 2. The clip routine is not general enough to handle this situation. So, there's room for improvement if you want to use this routine on irrational, rational, and logarithmic functions. On Dec 28, 2005, at 8:57 AM, Mojca Miklavec wrote:
Please, put this example on the wiki (together with some sample images that can be created, with or without some cheating).
The community would be greatful for that.
Hans, Taco, et al,
This is getting pretty close to the limit of my expertise. The good stuff of it is stolen from Metafun and mp-func.mp.
Because of the way I handle clipping the path,
p:=p cutbefore cpath; p:=reverse p; p:=p cutbefore cpath;
this will only work on functions (like lines, quadratics, and polynomials, maybe sinusoids) that both enter and leave the region inside the clipping path.
If I understand it properly (that you only want to draw the content inside the square, while the function may be a circle or something lying completely outside the region), you could also use something like clip currentpicture to cpath; although you may have to change the code that draws double arrow then.
Mojca
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context