[seek-dev] Re: change signature for convex hull actor

Jianting Zhang jzhang at lternet.edu
Tue Nov 30 14:19:42 PST 2004


My desktop finally recovered from its power supply failure a few days ago. 
It took me about an hour to make the modifications according to your 
requirement. The codes are available at
ftp://ftp.lternet.edu/pub/outgoing/jzhang/patch/

GISHull.zip: unzip it to {kepler}\src\cpp\gis\grass.
HullActor.zip: unzip it to {kepler}\src\org\ecoinformatics\seek\gis\grass
gisl.xml: put it in {kepler}\workflows\test

I have tested on windows platform using DataPoints.txt and the results seem 
to be correct.

The modification is fairly straightforward: counting the number of data 
points while reading the data file and then rewind the data file to actually 
read the data points. Since the number of data points in most of our 
applications does not reach million level, I'm expecting the midifcaiton has 
very tiny impact in terms of speed.

Jianting


----- Original Message ----- 
From: "Matt Jones" <jones at nceas.ucsb.edu>
To: "Jianting Zhang" <jzhang at lternet.edu>; "seek-dev" 
<seek-dev at ecoinformatics.org>
Sent: Wednesday, November 24, 2004 4:25 PM
Subject: change signature for convex hull actor


> Hi Jianting,
>
> I took a look at your convex hull cpp code and I think we should make a 
> slight change to make the actor easier to use.  Right now the actor 
> requires the number of points as input which is not necessary.  Could you 
> change the function in HullMain.cpp:
>
> int GISHull (char *pointDataFile, int numSitePoints, char *hullDataFile)
>
> to
>
> int GISHull (char *pointDataFile, char *hullDataFile)
>
> This can be implemented by opening the file and reading it, allocating 
> memory for the points as you go andy dynamically resizing the space for 
> the Points structure. I would probably allocate space for 100 points at a 
> time, and then truncate once you know the total number of points read when 
> you reach EOF (fscanf will return the EOF when it encoutners it).   You 
> can track the number of points as you read them in a counter and if the 
> points < 3 then return your error value (as you do now).  This will 
> simplify calling the actor, and will make the GISHull function more robust 
> (because it current is fragile if the numSitePoints is greater than the 
> actual number of points in the file.
>
> Could you make these changes?  If there are analogous simplifications in 
> the rasterization and buffering actors it would be good to make those too, 
> but they are less important.  Thanks,
>
> Matt
>
>
> 




More information about the Seek-dev mailing list