1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
version(1.0);
baseDir = "c:/Program Files/LandSerf/data/landscriptExamples/";
featureName = "peak";
decayExp = 0.0;
slopeTol = 20;
curveTol = 0.2;
minWinSize = 5;
maxWinSize = 19;
dem = open(baseDir & "dem.srf");
fuzzyFeature = new(dem);
winSize = minWinSize;
numScales = 0;
featureID = getFeatureID(featureName);
while (winSize <= maxWinSize);
{
echo("Processing with "&winSize&"x"&winSize&" window.");
numScales = numScales+1;
features = surfparam(dem_,"feature",winSize,decayExp,slopeTol,curveTol);
fuzzyFeature = ifelse(features==featureID,fuzzyFeature+1,fuzzyFeature);
winSize = winSize + 2;
}
fuzzyFeature = fuzzyFeature/numScales;
edit(fuzzyFeature,"title","Fuzzy "&featureName&" membership");
if (featureID == 1); { colouredit(fuzzyFeature,"rules","0 255 255 255, 1 0 0 0");}
if (featureID == 2); { colouredit(fuzzyFeature,"rules","0 255 255 255, 1 0 0 200");}
if (featureID == 3); { colouredit(fuzzyFeature,"rules","0 255 255 255, 1 0 150 0");}
if (featureID == 4); { colouredit(fuzzyFeature,"rules","0 255 255 255, 1 250 250 0");}
if (featureID == 5); { colouredit(fuzzyFeature,"rules","0 255 255 255, 1 200 0 0");}
if (featureID == 6); { colouredit(fuzzyFeature,"rules","0 255 255 255, 1 200 200 200");}
save(fuzzyFeature,baseDir&"fuzzy"&featureName&".srf");
function getFeatureID(featName)
{
if (compare(featName,"pit") == 0); {return 1;}
if (compare(featName,"channel") == 0); {return 2;}
if (compare(featName,"pass") == 0); {return 3;}
if (compare(featName,"ridge") == 0); {return 4;}
if (compare(featName,"peak") == 0); {return 5;}
if (compare(featName,"planar") == 0); {return 6;}
echo("Unknown feature type '"&featName&"'. Assuming 'planar'.");
return 6;
}
|