|
[Date Index]
[Thread Index]
[Author Index]
Re: How to create a mask with a hole in it?
- To: mathgroup at smc.vnet.net
- Subject: [mg15017] Re: [mg14985] How to create a mask with a hole in it?
- From: Jurgen Tischer <jtischer at col2.telecom.com.co>
- Date: Sat, 5 Dec 1998 01:30:20 -0500
- Organization: Universidad del Valle
- References: <199812020859.DAA23419@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
Michael,
this creates a rectangular mask with a circular hole with center {x,y},
radius r and rectangle with left lower corner {xmin,ymin} and right
upper corner {xmax,ymax}. I suppose you have a graphics object already
generated with AspectRatio set to Automatic (otherwise you'll have to
set it in Show.
hole[{x_,y_},r_,{{xmin_,ymin_},{xmax_,ymax_}}]:=
Polygon[{{x+r,y},{xmax,y},{xmax,ymax},{xmin,ymax},{xmin,ymin},{xmax,ymin},{
xmax,y},Sequence@@
Table[r {Cos[t],Sin[t]}+{x,y},{t,0,2\[Pi],2\[Pi]/(50 r)}]}]
You may want to change the parameter 50 to produce a smoother circle or
less code.
Usage:
Show[gr,Graphics[hole[{2,2},1,{{0,0},{4,4}}]],AspectRatio->Automatic,PlotRange->{{0,4},{0,4}}]
where gr is the graphic with the pattern, AspectRatio and PlotRange are
optional (I used PlotRange in my examples for clipping the pattern
which passed the rectangle).
Jurgen
Michael Kubovy wrote:
>
> I am requesting help to do the following: Show a pattern (a lattice of
> multicolored dots in this case) as if seen through a circular aperture
> in a rectangular black screen.
>
> |\ /| / Michael Kubovy, Professor of Psychology, Dept of Psychology |
> \/ | / Univ of Virginia, Gilmer Hall, Charlottesville, VA 22903-2477 |
> |/\ office (B011): 804-982-4729, lab (B019): -4751, fax: -4766 | |
> \ HTTP://www.virginia.edu/~mklab/
Prev by Date:
Re: Boundary Value Problems
Next by Date:
Re: problems installing ExtendGraphics
Previous by thread:
How to create a mask with a hole in it?
Next by thread:
Re: Blue screen of death after installing NT4 SP4
|