NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: How to draw a circle ?

Using Jython, I would just define the points in an array, and then call drawLine with the array. If you're using Java, then I would suggest you construct a Gridded2DSet with a manifold dimension = 1 and put the coordinates in there as the "samples". When you add this Data's reference object to your Display, it will render it as a line connecting the points (this is how lines are drawn). So...something like this:

float[][] samples = new float[2][361];
// fill up sampls with 361 values -- one degree, for example, around
Gridded2DSet cir = new Gridded2DSet(yourMathType, samples, 361)
DataReference cirref = new DataReference("circle");
cirref.setData(cir.getData());

tom


Helen Yi wrote:
Hi

Does anyone know how to draw a circle on a display?

Thanks,

helen


--
Tom Whittaker (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Cooperative Institute for Meteorological Satellite Studies
Phone/VoiceMail: 608.262.2759


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: