[GRASSLIST:7271] Re: Making ellipse polygons...

Hamish hamish_nospam at yahoo.com
Wed Jun 22 02:29:32 EDT 2005


> I was wondering if anyone knows of a way to make a set of evenly
> spaced, equal sized ellipse polygons of a given semimajor and
> semiminor axis.  Is there an add-on for grass that might have this
> functionality?

Geo-referenced or just on the display?

Generate the verticies in Matlab (or Octave, or whatever), save to a 
file, then--

On the display:  (after some formatting in the text file)
  d.graph or d.mapgraph

As a vector:
  import directly into GRASS with v.in.mapgen from CVS or
 "v.in.ascii format=standard -n" with some formatting to add "L ?" headings.



e.g., an ellipse centered on 0,0,0 with maj-axis=1 and minor-axis=2 and
twenty subdivisions.

% matlab commands
[X,Y,Z] = ellipsoid(0,0,0, 1,2,0, 20);
x = X(2,:)';
y = Y(2,:)';
data= [nan nan; x y; nan nan];   % nan's added for 'v.in.mapgen -f'
save ellips_pts.txt data -ASCII


# back in GRASS 6.1-cvs
#  (or just copy the v.in.mapgen script in to 6.0.0)
v.in.mapgen -f in=ellips_pts.txt out=test_ellips
g.region vect=test_ellips
d.vect test_ellips

# if you want to make them filled areas instead of lines:
v.type in=test_ellips out=test_ellipsBnd type=line,boundary
v.category option=add in=test_ellipsBnd out=test_ellipsArea


It would be interesting to make the 3rd axis something and try out the new
support for 3d vectors in NVIZ .....



Hamish




More information about the grass-user mailing list