ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Metapost intersections (offtopic)
@ 2000-05-23 11:45 Michal Kvasnicka
  2000-05-23 16:45 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Kvasnicka @ 2000-05-23 11:45 UTC (permalink / raw)


Hallo!

Excuse me plese to ask this offtopic, but I know some of you are quite
experienced
in Metapost.

I do have some general curve. I want to draw just th part of it that
lies inside some
box. This is simple enough if you use the clip command. But such results
I don't like
because ends of the lines are spoiled as cropped.

I thought it would be easy to find the first intersection between the
curve and the box
and draw the part of line (from the beginning to the intersection point)
if the line
is outside the box. Then to cut this part of the path off and repeat the
process. But
the time is changed by subpath command in such a way I don't understand.
Moreover
I don't know what result I can get if the curve would be linear and
would go over
the box.

Has some of you some working code that handles this (or similar)
problem?

Many thanks for any answer and one more excuse for the offtopic.

Your sincerely
Michal Kvasnicka

--
Economics is the only field in which two people can get a Nobel Prize
for saying exactly the opposite things.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Metapost intersections (offtopic)
  2000-05-23 11:45 Metapost intersections (offtopic) Michal Kvasnicka
@ 2000-05-23 16:45 ` Hans Hagen
  2000-05-23 18:09   ` Ed L Cashin
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2000-05-23 16:45 UTC (permalink / raw)
  Cc: Context

At 01:45 PM 5/23/2000 +0200, Michal Kvasnicka wrote:

>process. But
>the time is changed by subpath command in such a way I don't understand.

It is a rather manual job I fear (some color and points added for
educational purposes): 

input mp-tool ;

beginfig(1) ;

path some_line ; some_line := (-100,-100)..(0,50)..(100,100) ;
path some_circ ; some_circ := fullcircle scaled 150 ;
path some_curv ; some_curv := some_circ cutafter point 2  of some_circ ;

pickup pencircle scaled 2 ; draw some_line ; draw some_circ ;

pair point_one ; point_one := some_line intersectionpoint some_circ ;
pair point_two ; point_two := some_line intersectionpoint some_curv ;

pickup pencircle scaled 5 ;
draw point_one withcolor red  ;
draw point_two withcolor blue ;

some_line := some_line cutbefore point_one ;
some_line := some_line cutafter  point_two ;

pickup pencircle scaled 2 ;
drawarrow some_line withcolor green ;
drawarrow reverse some_line withcolor green ;

endfig ;

end .

(It's about time I start writing that book about graphics -) 

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Metapost intersections (offtopic)
  2000-05-23 16:45 ` Hans Hagen
@ 2000-05-23 18:09   ` Ed L Cashin
  0 siblings, 0 replies; 3+ messages in thread
From: Ed L Cashin @ 2000-05-23 18:09 UTC (permalink / raw)
  Cc: Michal Kvasnicka, Context

Hans Hagen <pragma@wxs.nl> writes:

> (It's about time I start writing that book about graphics -) 

Sign me up for a copy!

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-05-23 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-23 11:45 Metapost intersections (offtopic) Michal Kvasnicka
2000-05-23 16:45 ` Hans Hagen
2000-05-23 18:09   ` Ed L Cashin

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).