dung-han-lee / convexhull-3d-implementation-of-incremental-convexhull-algorithm Goto Github PK
View Code? Open in Web Editor NEWc++ implementation of 3D incremental convell hull algorthim
License: Other
c++ implementation of 3D incremental convell hull algorthim
License: Other
I have some trouble with "warning: property violated!"
I forked your repo so I could try to improve some things. I used commit milasudril@374f76e
I get an error when trying to compute the convex hull of the attached point cloud.
mesh.obj.gz
int MinimumZoneFitPlane(const Point* pointsIn, int lengthIn, PlaneKernel* outLseg)
{
ConvexHull hull(pointsIn, lengthIn);
std::list faces = hull.GetFaces();
std::vector vertexs = hull.GetVertices();
std::vector pointT(vertexs.size());
for (int i = 0; i < vertexs.size(); i++) {
pointT[i].x = vertexs[i].x;
pointT[i].y = vertexs[i].y;
pointT[i].z = vertexs[i].z;
}
std::string filePath = "D:/CMM/PlanePointsVertex.csv";
WritePointsCSV(pointT.data(), pointT.size(), filePath.c_str());
return Geom3DError::OK;
}
The above is the call code for computing the 3D convex hull, the result is not correct;
PlanePoints.csv
In case you have a hash collision when computing the hash of the pair of points, you will overwrite existing entries. Instead of using the hash as a key, you should use the actual pair, and use an associated hash function, ie:
struct PointHash
{
size_t operator()(Point3D a) const
{
return std::hash<double>{}(a.x) ^ std::hash<double>{}(a.y) ^ std::hash<double>{}(a.z);
}
};
struct EdgeEndpoints
{
Point3D p1;
Point3D p2;
constexpr bool operator==(const EdgeEndpoints&) const = default;
constexpr bool operator!=(const EdgeEndpoints&) const = default;
};
struct EdgeEndpointHash
{
size_t operator()(EdgeEndpoints const& a) const
{
return PointHash{}(a.p1) ^ PointHash{}(a.p2);
}
};
std::unordered_map<EdgeEndpoints, Edge*, EdgeEndpointHash> map_edges;
Also, please do not convert to string when computing hashes.
It is not recommended to compare floating point numbers with ==
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.