-
Notifications
You must be signed in to change notification settings - Fork 137
Using Inbuilt Datastructures #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
037f063
4313227
ff28542
56af511
ad1e0a2
1043e4c
c8d439f
7db3291
88d6f7e
7787cc0
d08ad80
50ad8db
d75cc31
8b3963e
d9edae6
76d4126
b46e7ce
7303107
f95fe21
fdaf121
9432445
8c6525a
b0fbf4c
24f4add
87aad9b
abfd857
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -478,6 +478,35 @@ | |
Finish(); | ||
} | ||
|
||
void Manifold::Impl::Hull(const std::vector<glm::vec3>& vertPos) { | ||
size_t numVert = vertPos.size(); | ||
if (numVert < 4) { | ||
status_ = Error::InvalidConstruction; | ||
return; | ||
} | ||
|
||
Vec<glm::dvec3> pointCloudVec(numVert); | ||
manifold::transform(vertPos.begin(), vertPos.end(), pointCloudVec.begin(), | ||
[](const glm::vec3& v) { return glm::dvec3(v); }); | ||
QuickHull qh(pointCloudVec); | ||
ConvexHull hull = qh.getConvexHullAsMesh(pointCloudVec, false); | ||
// TODO : Once double PR lands, replace this with move | ||
vertPos_.resize(hull.vertices.size()); | ||
manifold::transform(hull.vertices.begin(), hull.vertices.end(), | ||
vertPos_.begin(), | ||
[](const glm::dvec3& v) { return glm::vec3(v); }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make a note that we can replace with this |
||
halfedge_ = std::move(hull.halfedges); | ||
meshRelation_.originalID = ReserveIDs(1); | ||
CalculateBBox(); | ||
SetPrecision(bBox_.Scale() * kTolerance); | ||
SplitPinchedVerts(); | ||
CalculateNormals(); | ||
InitializeOriginal(); | ||
CreateFaces({}); | ||
SimplifyTopology(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with your analysis, but let's leave it to the next PR to optimize exactly what's needed here. |
||
Finish(); | ||
} | ||
|
||
/** | ||
* Create either a unit tetrahedron, cube or octahedron. The cube is in the | ||
* first octant, while the others are symmetric about the origin. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw why are we taking
std::vector
here? shouldn't we takeVecView
?