MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: coloring eveerything outside a circle

  • To: mathgroup at
  • Subject: [mg31866] Re: [mg31819] Re: coloring eveerything outside a circle
  • From: BobHanlon at
  • Date: Sat, 8 Dec 2001 05:51:41 -0500 (EST)
  • Sender: owner-wri-mathgroup at

In a message dated 12/5/01 9:55:54 AM, mipam at writes:

>> Making something like a black inner tube (whith a white center) is trivial.
>> To do that you show a circle and then a smaller white circle on-top of
>> first circle.  However, it's a little tricky if you want to "see" the
>> graphics behind the center of the inner tube.  Below I show how that
>can be
>> done. 
>> --------------------------
>> Block[{$DisplayFunction=Identity},
>>     gr1=ParametricPlot[ {2*Sin[t], 2*Cos[t]+2}, {t, 0, 2 Pi} ];
>>     gr2=ParametricPlot[ {Sin[t]+1/2, Cos[t]+2}, {t, 0, 2 Pi} ]
>> ];
>> pnts=Join[ Part[gr1,1,1,1,1], Part[gr2,1,1,1,1] ];
>> gr3=Graphics[ { Hue[1], Polygon[pnts] } ];
>> gr4=Graphics[ { Hue[0.6], Polygon[ {{-2.5,3.75}, {-2.5,3.5}, {3,0.75},
>> {3,1}} ] }];
>> Show[{gr4,gr3}, AspectRatio->Automatic];
>Thanks for your answer, but i was looking for something like this:
>p1=ParametricPlot[ {Cos[t], Sin[t]}, {t, 0, 2 Pi} ];
>p2=ParametricPlot[ {Cos[t], 0.5+Sin[t]}, {t, 0, 2 Pi} ];
>Now, the thing is, i wish to show p2 only for the part which is contained
>inside p1. Normally to do this, i'd have to solve the two corresponding
>equations, equal the y value to Sin[t] for example and find the t and
>draw p2 restricted to those two t value's.
>But .... when you got lets say 20 p's to show and you wish to show only
>those parts which are contained inside p1, you'd have to calculate a lot
>of intersections and then the corresponding t's etc.
>However, i was thinking, why not just draw all these circles
>and paint everything white outside p1 so that it has the same effect.
>It was save mathematica a LOT of calculating time.
>Any ideas?
>----------------------- Headers --------------------------------


"4.1 for Power Macintosh (November 2, 2000)"


    Plot[x, {x,0,10}],
      {x, 0, 10}, {y,0,10}], 
    AspectRatio -> Automatic];

      {t,0,2 Pi}, PlotStyle->Red],
        -1< y<2, 
        -1.5< x<1.5], 
      {x, -1.5, 1.5}, {y,-1,2},
      PlotStyle->White, Fills->White], 
    Frame -> True, Axes ->False,
    AspectRatio -> Automatic];

Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Re: can I add fonts to Mathematica
  • Next by Date: Re: scope all wrong? in Mathematica 4.1
  • Previous by thread: Re: coloring eveerything outside a circle
  • Next by thread: Surface graphics (Plot3D) colouring question