Re: Re: coloring eveerything outside a circle
- To: mathgroup at smc.vnet.net
- Subject: [mg31866] Re: [mg31819] Re: coloring eveerything outside a circle
- From: BobHanlon at aol.com
- Date: Sat, 8 Dec 2001 05:51:41 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 12/5/01 9:55:54 AM, mipam at ibb.net 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 >the >> 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? >Bye, > >Mipam. > > > > >----------------------- Headers -------------------------------- $Version "4.1 for Power Macintosh (November 2, 2000)" Needs["Graphics`Graphics`"]; Needs["Graphics`Colors`"]; Needs["Graphics`InequalityGraphics`"]; DisplayTogether[ Plot[x, {x,0,10}], InequalityPlot[And[ (x-5)^2+(y-5)^2>9, (x-5)^2+(y-5)^2<25], {x, 0, 10}, {y,0,10}], AspectRatio -> Automatic]; DisplayTogether[ ParametricPlot[ {Cos[t],0.5+Sin[t]}, {t,0,2 Pi}, PlotStyle->Red], InequalityPlot[And[x^2+y^2>1, -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