Hans et al,
I think I've found something that works. I know ahead of time that
there will only be two crossings of the clipping path boundary (I make
sure of the by the parameters I choose):
beginfig(0);
% initialize a, h, and h for f(x)=ax^2+bx+c=a(x-h)^2+k
numeric a, h, k;
a=-1;
h=-3;
k=2;
Hans et al,
I tried what follows. But as far as I can see, I am not getting back a
path q that is clipped to the cpath.
vardef lastpath (expr p) =
save _p_ ; path _p_ ; _p_ := origin ;
for i within p :
if stroked i : _p_ := pathpart i ; fi ;
endfor ;
_
David Arnold wrote:
Hans et al,
Let me try to be more specific. Here is a file which is very typical
of the way I draw graphs for my mathematics classes. When you compile,
you will see the graph of the absolute value of x-1. That is, it draws
the graph of y=|x-1|, but only after clipping it
David Arnold wrote:
Hans,
I tried:
% redraw line
path q;
q:=pathpart pic;
drawdblarrow q withcolor blue;
But it drew the clipping path. I wanted the part of the path inside
the clipping path.
Am I missing something in your directions?
ok, here's the full solution ...
\starttext
\setup
Hans et al,
Let me try to be more specific. Here is a file which is very typical of
the way I draw graphs for my mathematics classes. When you compile, you
will see the graph of the absolute value of x-1. That is, it draws the
graph of y=|x-1|, but only after clipping it to the cpath. What I
Hans,
I tried:
% redraw line
path q;
q:=pathpart pic;
drawdblarrow q withcolor blue;
But it drew the clipping path. I wanted the part of the path inside the
clipping path.
Am I missing something in your directions?
On Aug 7, 2005, at 2:56 PM, Hans Hagen wrote:
David Arnold wrote:
This
David Arnold wrote:
This works fine. However, what I need to do is somehow clip the path P
to the bounding box, but retain the resulting cutpath in a path
variable Q. That is, I need to cut off the parts of the path P that
lie outside the bounding box
cpath:=(-5,-5)--(5,-5)--(5,5)--(-5,5)--
All,
I'm looking for a new idea for something I need to do. I typically
create a path on a domain [-5,5] as follows, a arbitrary. Then I
randomly reflect the path about and axis, a line, or maybe rotate it.
The result is that parts of the path may lie outside a bounding window.
% define line