Skip to content

Commit

Permalink
Fixed bug pivoting rutine
Browse files Browse the repository at this point in the history
  • Loading branch information
rodschulz committed Jun 5, 2015
1 parent 7932df9 commit f05fb93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/Pivoter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pair<int, TrianglePtr> Pivoter::pivot(const EdgePtr &_edge)
for (size_t t = 0; t < indices.size(); t++)
{
int index = indices[t];
if (v0.second == index || v1.second == index || op.second == index || used[index])
if (v0.second == index || v1.second == index || op.second == index)
continue;

/**
Expand All @@ -76,7 +76,7 @@ pair<int, TrianglePtr> Pivoter::pivot(const EdgePtr &_edge)
vector<int> neighborhood = getNeighbors(ballCenter, ballRadius);
if (!isEmpty(neighborhood, v0.second, v1.second, index))
{
cout << "Discarded for neighbors: " << index << "\n";
cout << "\tDiscarded for neighbors: " << index << "\n";
Writer::writeCircumscribedSphere("discarded_neighbors", center, ballRadius, Triangle(v0.first, v1.first, &cloud->at(index), v0.second, v1.second, index, center, ballRadius), cloud);
continue;
}
Expand All @@ -87,7 +87,7 @@ pair<int, TrianglePtr> Pivoter::pivot(const EdgePtr &_edge)
Vector3f faceNormal = Vik.cross(Vij).normalized();
if (!Helper::isOriented(faceNormal, (Vector3f) v0.first->getNormalVector3fMap(), (Vector3f) v1.first->getNormalVector3fMap(), (Vector3f) cloud->at(index).getNormalVector3fMap()))
{
cout << "Discarded for normal: " << index << "\n";
cout << "\tDiscarded for normal: " << index << "\n";
vector<TrianglePtr> data;
data.push_back(TrianglePtr(new Triangle(v0.first, v1.first, &cloud->at(index), v0.second, v1.second, index, center, ballRadius)));
Writer::writeMesh("discarded_normal", cloud, data);
Expand All @@ -103,6 +103,7 @@ pair<int, TrianglePtr> Pivoter::pivot(const EdgePtr &_edge)
// TODO fix point selection according to the angle
if (output.first == -1 || currentAngle > angle)
{
cout << "\tPoint selected: " << index << "\n";
currentAngle = angle;
output = make_pair(index, TrianglePtr(new Triangle(v0.first, &cloud->points[index], v1.first, v0.second, index, v1.second, center, ballRadius)));
}
Expand Down
3 changes: 0 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ using namespace pcl;

int main(int _argn, char **_argv)
{
// TODO check if the seed selection is selecting correctly a ball which is above the surface according to the normals
// TODO check if the pivoting method is selecting correctly the next point according to the angle
// TODO fix the pivoting method to take into account points that can't be added because the face normal is downwards
//

system("rm -rf ./output/*");

Expand Down

0 comments on commit f05fb93

Please sign in to comment.