On Mon, May 25, 2009 at 12:49 PM, Alan W. Irwin
<[email protected]> wrote:
> On 2009-05-25 00:22-0400 Hezekiah M. Carty wrote:
>
>> I would like to implement a plcircle function in PLplot.  I have a few
>> questions before I start making commits:
>>
>> 1. Should a call to plcircle draw one circle or many?
>>
>> a) plcircle(PLINT n, PLFLT *x, PLFLT *y, PLFLT *r)
>>
>> vs
>>
>> b) plcircle(PLFLT x, PLFLT y, PLFLT r)
>>
>> I am leaning toward (b), but I am content with either option.
>>
>> 2. How should the aspect ratio of the plot be handled?  My current
>> implementation, and I think the simplest to start with, is what is
>> done in example 3 - draw a set of N lines approximating a circle,
>> ignoring the aspect ratio.  This leads to squished circles if the
>> x-axis and y-axis scales are unequal.  I think that this is
>> reasonable, as otherwise the definition of a radius becomes ambiguous.
>> I would like to hear some other opinions on this though.
>>
>> 3. Should there be separate functions for filled vs unfilled circles?
>> Or should this be passed as an extra argument to plcircle?
>>
>> I can add plcircle, plarc and plellipse (or similar) functions to
>> PLplot, using the answers to the questions above.  I can also add
>> support for a driver-specific circle/arc/ellipse rendering path.  I
>> know Cairo has support for these primitives and I imagine some of the
>> libraries behind the other output drivers do as well.
>>
>> Comments?
>
> There are some well-known disadvantages to expanding our API.  There is cost
> to us (e.g., documentation of the added API, propagation of the added API to
> all languages, changing examples to use the the new API for all languages).
> In addition, users generally find a small API easier to master than a large
> one.
<cut>
> ... I
> suggest you provide a few sentences stating what you expect the general use
> case will be along with your own particular use case(s).

My personal use cases are currently marking satellite radar footprints
and drawing custom diagrams/shapes on plots.  I am currently doing
this using either plline or plfill, similar to how circles are drawn
in the examples.  The main drawback I have experienced with this
method is that drawing an arc as a series of line segments or as a
filled polygon can have a large impact on the file size of vector
output (PS, PDF).

To clarify on a question asked later in the thread, I intend this
function to be for plotting another set of geometric shapes, not
necessarily something which will always look like a circle.  If an
example is added for plarc then aspect-ratio correction would probably
be a nice page to include in that example.

> Assuming everybody feels the justification for this API addition is
> persuasive, then you might want to consider generalizing the API as much as
> possible.

Based on this, I reworked the (only) function prototype so that it
currently looks like this:

void
c_plarc(PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT
angle2, PLFLT rotation, PLBOOL fill);

where:

x, y - center of the arc
a and b - semimajor and semiminor axes
angle1, angle2 - start and end angles for the arc
rotation - rotation of the arc about (x, y)
fill - should the arc be filled?

Angles are all provided in degrees.  I have an initial "raw"
implementation in place for devices which do not support an arc
primitive.  This uses plline and plfill internally.  It modified
example 3 locally to use plarc and the results seem reasonably
accurate.  I have a started a Cairo implementation but I don't have
the coordinate transformation correct from world coordinates to Cairo
coordinates.  I will ask about that in a separate email.

Thank you to everyone who made comments during my extended delay on
getting back to this thread.

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to