Created
February 28, 2011 12:25
-
-
Save att88/847250 to your computer and use it in GitHub Desktop.
Compute Planarity of a 3D point using approach 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double PointCloud::computePlanarity(int pointIndex) { | |
PointCloud p; | |
p.points.push_back(points[pointIndex]); | |
for (int i = 0; i < (int)points.size(); i++) { | |
if(i != pointIndex && points[i].distanceTo(points[pointIndex]) <= MaxEPS) { | |
p.points.push_back(points[i]); | |
} | |
} | |
Plane plane = p.bestFittingPlane(); | |
double dist = 0; | |
for (int i = 0; i < (int)p.points.size(); i++) | |
dist += p.points[i].distanceTo(plane); | |
dist /= p.points.size(); | |
return dist; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment