RE: MaxBend in ParametricPlot?
- To: mathgroup at smc.vnet.net
- Subject: [mg12961] RE: [mg12924] MaxBend in ParametricPlot?
- From: Ersek_Ted%PAX1A at mr.nawcad.navy.mil
- Date: Sun, 28 Jun 1998 02:51:50 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Matthias Weber wrote: | | |I am having trouble with the results I get by ParametricPlot. The |documentation is sufficiently incomplete to prevent me from calling |this a bug, but at least I would like to report the _behaviour_ I am |unhappily confronted with: | |When I draw a round circle with ParametricPlot, I would expect to get |the sample points more or less equidistributed, but the resulting |distribution is rather strange. At the end is some code illustrating |what I will explain now. | |The online doc says that Plot and ParametricPlot use an adaptive |algorithm so that the kink angle between successive segments does not |exceed MaxBend, which is '10' by default. (10 degrees, I suppose?). The |minimal number of sample points is given by PlotPoints, which initially |is 25. | |If I set MaxBend->1000 (degrees??), I get a list of 39 points. When |setting PlotDivision->1 (which, as I understand it, should prevent any |further subdivision), I get 40 points. All this lacks an explanation to |me. | |The kink angle between consectutive segments on the drawn unit circle |with initial settings varies (roughly) between 0.4 and 8.0 degrees, |points with small kink angle accumulate near the points |{0,0},{0,1},{-1,0},{0,-1}. | |For the application I have in mind I want to extract the data computed |by ParametricPlot and to use them, but I was hoping that ParametricPlot |gives 'more adaptive' results. Is there a parameter setting which gives |(near) equidistribution for a circle and is nevertheless adaptive in |general? Is there |a desription of the algorithm behind ParametricPlot available? Has |somebody written his/her own version already? | | _The Mathematica Graphics Guidebook_ by C. Smith & N. Blachman discusses (in great detail) the sampling algorithm Plot and ParametricPlot used in Version 2.2. I suspect the algorithm hasn't changed for version 3.0. This aspect of the sampling algorithm is discussed on pages 89-93 of the above book. In this discussion the authors explain that "bend angle" is computed by normalizing the distances between adjacent samples so the three points used to form an angle fit into a box with length of one on each side. They say if A is a vector from the middle sample to the left sample, and B is a vector from the middle sample to the right sample. Then Cos[BendAngle]=Dot[A,B]/(Magnitute[A] Magnitude[B]) This results in excessive sampling where the plot is vertical or horizontal. However it also has an advantage in that you can zoom in on a graphic (without taking more samples) and the curve still looks smooth. Here is an example: In[1]:= cir=ParametricPlot[{Cos[t],Sin[t]},{t,0,2 Pi},AspectRatio->Automatic]; In[2]:= Show[cir, PlotRange->{{-0.03,0.03},{0.9993,1.}}, AspectRatio->1 /4, ImageSize->{250,250}, Axes->None]; I don't know how to use the options to get the results you are looking for. Ted Ersek