MCPcopy Create free account
hub / github.com/andybarry/makerscanner / AverageList

Method AverageList

PointCloud.cpp:130–153  ·  view source on GitHub ↗

average a linked list of points to handle a case where we have more than one point per h, laserPos

Source from the content-addressed store, hash-verified

128
129// average a linked list of points to handle a case where we have more than one point per h, laserPos
130PointCloudPoint PointCloud::AverageList(ListOfCloudPoints *thisList)
131{
132 double number = double(thisList->GetCount());
133
134 double sumDist = 0;
135
136 PointCloudPoint *point = NULL;
137
138 // iterate over the list and average all values
139 for ( ListOfCloudPoints::Node *node = thisList->GetFirst(); node; node = node->GetNext() )
140 {
141
142 point = node->GetData();
143 sumDist += point->dist;
144 }
145
146 if (point == NULL)
147 {
148 return PointCloudPoint(0, 0, 0, 0, 0, 0, 0, 0, 0);
149 }
150
151 return PointCloudPoint(sumDist/number, point->theta, point->phi, point->r, point->g, point->b, point->w, point->h, point->laserPosition);
152
153}

Callers

nothing calls this directly

Calls 1

PointCloudPointClass · 0.85

Tested by

no test coverage detected