Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: coloring eveerything outside a circle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31819] Re: coloring eveerything outside a circle
  • From: Mipam <mipam at ibb.net>
  • Date: Wed, 5 Dec 2001 06:51:42 -0500 (EST)
  • References: <E1168E31432DD211AF990000F806EFD804E1E720@nems04.nawcad.navy.mil>
  • Sender: owner-wri-mathgroup at wolfram.com

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



  • Prev by Date: scope all wrong? in Mathematica 4.1
  • Next by Date: Re: Re: Path finding in graph theory, Lookig for your help
  • Previous by thread: Re: coloring eveerything outside a circle
  • Next by thread: Re: Re: coloring eveerything outside a circle