Go to the documentation of this file.00001 #include <math.h>
00002
00003 #include "csm_all.h"
00004
00005
00006
00007
00008
00009
00010
00011 void ld_simple_clustering(LDP ld, double threshold) {
00012 int cluster = -1;
00013 double last_reading = 0;
00014
00015
00016
00017 int i;
00018 for(i=0;i<ld->nrays;i++) {
00019
00020 if(!ld_valid_ray(ld,i)) {
00021 ld->cluster[i] = -1;
00022 continue;
00023 }
00024
00025 if(-1==cluster)
00026 cluster = 0;
00027 else
00028
00029 if( fabs(last_reading-ld->readings[i]) > threshold)
00030 cluster++;
00031
00032 ld->cluster[i] = cluster;
00033 last_reading = ld->readings[i];
00034 }
00035
00036
00037 }
00038