[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What does command fill exactly return?
From: |
Maynard Wright |
Subject: |
Re: What does command fill exactly return? |
Date: |
Thu, 24 Jun 2010 12:21:52 -0700 |
User-agent: |
KMail/1.10.1 (Linux/2.6.27-7-generic; KDE/4.1.4; i686; ; ) |
On Thursday 24 June 2010 05:17:40 Ben Abbott wrote:
> On Jun 24, 2010, at 8:04 AM, Maynard Wright wrote:
> > On Thursday 24 June 2010 04:41:54 Ben Abbott wrote:
> >> On Jun 23, 2010, at 5:54 AM, sd83 wrote:
> >>> Dear all,
> >>>
> >>> I'm working with curves and I have this problem: I have sampled closed
> >>> curves and I want to find the interior part of them. I have done some
> >>> experiments using fill command but I haven't find what I'm looking for.
> >>> I try to explain you the problems that I have find by examples.
> >>>
> >>> Let
> >>> t=[0:1/100:2*pi]
> >>> and
> >>> (cos(t),sin(t)) the unit circle.
> >>> If I run
> >>> fill(cos(t),sin(t));
> >>> it returns the plot of the circle with the interior part colored and
> >>> it's ok, but if I run
> >>> fill(cos(2*t),sin(2*t));
> >>> it returns only the plot of the cicle without the interior part
> >>> colored. Why? For my purpose (cos(t),sin(t)) and (cos(2*t),sin(2*t))
> >>> have the same interior part.
> >>> I have noted that if I have a self intersect curve like two circles
> >>> with no empty intersection (but not only a point) command fill returns
> >>> the plot of the curve but the intersection of the circles is not
> >>> colored. Why? For my purpose the interior part of the two circles is
> >>> the union of the internal parts of them and not this union wthout the
> >>> intersection. How can I solve my problem? Is fill the best command I
> >>> can run becouse of my purpose?
> >>>
> >>> thank you
> >>
> >> I tried the following in Matlab
> >>
> >>>> fill(cos(t),sin(t),'r')
> >>
> >> The line above produced a circle filled with red and a black edge color.
> >>
> >> The line below produced an empty circle with a black edge color.
> >>
> >>>> fill(cos(2*t),sin(2*t),'r')
> >>
> >> I haven't looked at the detail, but I'd guess this respects the patch
> >> object. Replacing "fill(...)" with "patch(...)" gives the same result
> >> for me.
> >>
> >> Ben
> >
> > Note that fill(cos(2*t), sin(2*t), 'r') writes two complete circles
> > overlapping each other. Try:
> >
> > t=[0:1/100:1.5*pi]
> > fill(cos(2*t), sin(2*t), 'r')
> >
> > and observe that half the circle is filled, presumably because the second
> > circle is only half written over the first. Because of the odd/even
> > anomaly noted by others, I suggest that (maybe) fill applied to exactly
> > coincident figures toggles the fill color on and off. I haven't looked
> > at the code.
> >
> > Maynard Wright
>
> I haven't looked at the implementation for how patch objects are rendered
> in Matlab, Gnuplot, or using Octave's FLTK backend. However, for these
> examples they each behave in the same way.
>
> I'd guess there is a standard approach to drawing fillied polygons that
> each of these implementations share.
>
> Ben
Another way to examine what's happening is to execute the following:
t=[0:1/100:2*pi]
fill(cos(3*t)+0.05*t, sin(3*t), 'r')
Then run
fill(cos(4*t)+0.05*t, sin(4*t), 'r')
and compare the two plots.
The slight offset of the different (not quite) circles shows that each time an
area is filled that is already filled, the original fill is simply removed.
Maynard Wright