On 9/10/2019 11:23 AM, Jens Axel Søgaard wrote:
Den tir. 10. sep. 2019 kl. 17.04 skrev Hendrik Boom
<hend...@topoi.pooq.com <mailto:hend...@topoi.pooq.com>>:
On Tue, Sep 10, 2019 at 03:23:43PM +0200, Jens Axel Søgaard wrote:
> I have extended "clipped" to handle regions defined by more than
one path.
> Now (clipped c ... p) will make a region from the curves c ...
and use
> the region to clip the pict p. Most common uses:
>
> (clipped c p) the part of p inside c
> (clipped c1 c2 p) the part of p between c1 and c2 (if c2 is
inside c1)
Does that mean the part of p that is inside c1 and outside c2? (which
would be meaningful even if c1 and c2 intersect? That might happen
because of numerical instability.)
Whether is point is inside or outside the region given by the
two curves is decided by the "winding rule". See the
discussion on fill (which also uses the winding rule):
https://docs.racket-lang.org/metapict/index.html?q=metapict#%28def._%28%28lib._metapict%2Fdraw..rkt%29._fill%29%29
For filling with the even-odd rule I have an eofill, but I haven't
written an eoclipped yet.
/Jens Axel
Just a couple of points relevant to using regions in general:
- any region can be selected as the clipping region for drawing.
- a region can be created from any closed figure: a rectangle, an
ellipse, a looping point path, etc.
- a region can be created by combining other regions using union,
subtraction, and intersection.
- a single region can cover multiple disjoint areas.
And a hint:
If you are attempting to "shade" objects by painting them with a partly
transparent brush, you may (and probably will) end up with Moire
patterns where objects overlay / intersect each other. The way to apply
shade without worrying about Moire is to create a single region that
simultaneously covers all the to-be-shaded areas, and then to fill/paint
that region with your chosen shading brush.
YMMV,
George
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/d201f4a1-5de0-e540-c1ae-8ac02c4d981e%40comcast.net.