Nils Wagner wrote:
> Hi all,
>
> Is there a simple way to reject the points outside the parametrized
> curve ?
> I mean I would like to use meshgrid for "arbitrary" shaped domains.
>
> Any idea would be appreciated.
>
> Nils
>
> ------------------------------------------------------------------------
>
> from scipy import *
> from pylab import plot, show, meshgrid
> N = 100
> phi = linspace(0,2*pi,N,endpoint=False)
> p = zeros(N, Complex)
> q = zeros(N, Complex)
> p.real = cos(phi)-0.5*cos(phi)*sin(2*phi)
> p.imag = sin(phi)+cos(4*phi)/6
> x=arange(-1.5,1.5,0.1)
> y=arange(-1.5,1.5,0.1)
> X,Y = meshgrid(x,y)
> plot(p.real,p.imag,X,Y,'r.')
> show()
>
Sorry for replying to myself but just now I have found the fill command.
Is it somehow possible to extract coordinates from the blue domain
(image.png) ?
from scipy import *
from pylab import plot, show, meshgrid, fill
N = 100
phi = linspace(0,2*pi,N,endpoint=False)
p = zeros(N, Complex)
q = zeros(N, Complex)
p.real = cos(phi)-0.5*cos(phi)*sin(2*phi)
p.imag = sin(phi)+cos(4*phi)/6
x=arange(-1.5,1.5,0.1)
y=arange(-1.5,1.5,0.1)
X,Y = meshgrid(x,y)
plot(p.real,p.imag,'k-',X,Y,'r.')
q = fill(p.real,p.imag)
show()
Nils
|