-
Hi, I'm trying to implement an algorithm for pushing a face of a manifold in the direction of its normal. I would like to kindly ask you for your opinion whether I'm heading in the right direction or for ideas how to make it more realiable. Vocabulary:
Input:
Output:
Algorithm:
I'm aware that bad thing can happen. For example, if the border edge that drives the direction of the displacement is too short, the result will be useless. What I'm afraid of is that I might end up with extra faces (almost coplanar) due to rounding errors. That would make problems with additional face pushing later in the workflow. What do you think? Is it good approach or should I go for another solution? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
As long as you keep track of the parent face of each triangle (akin to what Considering you're already restricted on not collapsing edges, I'd avoid retriangulation entirely. You should be able to look up the 3 unique faces by checking the triangles involved. Going back and forth from triangles to polygons is also dangerous (and slow) and should be avoided when possible. |
Beta Was this translation helpful? Give feedback.
-
Could I please have another question related to this topic? As I'm working towards "push faces" functionality, I've implemented the following constructor which can make a manifold from a set of 3D polygons, which is great. However, it has one serious drawback. The vertex indices are changed in the output manifold and therefore I'm not able to track the relation between the input 3D polygons and the faces reported by Is it somehow possible to get the information on how the vertices were reordered during manifold initialization without comparing the coordinates of input and output vertices? Manifold Manifold::Polyhedron(
const std::vector<glm::vec3> vertPos,
const std::vector<std::vector<std::vector<int>>>& polygonsVec,
const std::vector<glm::vec3> normals) {
auto pImpl_ = std::make_shared<Impl>();
auto& _vertPos = pImpl_->vertPos_;
VecDH<glm::ivec3> triVertsDH;
auto& triVerts = triVertsDH;
for (auto& vert : vertPos) {
_vertPos.push_back(vert);
}
for (int i = 0; i < polygonsVec.size(); i++) {
auto& polygons = polygonsVec[i];
auto& normal = normals[i];
const glm::mat3x2 projection = GetAxisAlignedProjection(normal);
auto polygons2d = To2DPolygon(polygons, projection, _vertPos);
auto tris = Triangulate(polygons2d);
for (auto& tri : tris) {
triVerts.push_back({tri[0], tri[1], tri[2]});
}
}
pImpl_->CreateHalfedges(triVertsDH);
pImpl_->Finish();
pImpl_->InitializeNewReference();
return Manifold(pImpl_);
} |
Beta Was this translation helpful? Give feedback.
Could I please have another question related to this topic? As I'm working towards "push faces" functionality, I've implemented the following constructor which can make a manifold from a set of 3D polygons, which is great. However, it has one serious drawback. The vertex indices are changed in the output manifold and therefore I'm not able to track the relation between the input 3D polygons and the faces reported by
getMeshRelation
function called on the resulting manifold.Is it somehow possible to get the information on how the vertices were reordered during manifold initialization without comparing the coordinates of input and output vertices?