Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
cartesian-theatrics committed Apr 25, 2024
1 parent 25f8ec2 commit 8940811
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/manifold/src/manifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,10 @@ std::vector<glm::mat4x3> Manifold::surfaceMap(const std::vector<glm::mat4x3>& tr
for (int halfEdgeIdx : edges) {
glm::vec3 startVert = vertPos[halfedges[halfEdgeIdx].startVert];
glm::vec3 endVert = vertPos[halfedges[halfEdgeIdx].endVert];
// cout << "startVert: " << startVert.x << " " << startVert.y << " " << startVert.z << endl;
// cout << "endVert: " << endVert.x << " " << endVert.y << " " << endVert.z << endl;
// cout << "tfPos: " << tfPos.x << " " << tfPos.y << " " << tfPos.z << endl;
// cout << "tfDirX" << tfDirX.x << " " << tfDirX.y << " " << tfDirX.z << endl;

float intersectDist = intersectionDistance(tfPos, tfDirX, startVert, glm::normalize(endVert - startVert), faceNormal);
if (intersectDist > 0.0001 && intersectDist < std::numeric_limits<float>::max() && intersectDist < minDistance) {
cout << "minDistance: " << minDistance << " intersectDist: " << intersectDist << endl;
cout << "minDistance: " << minDistance << ", intersectDist: " << intersectDist << endl;
minDistance = intersectDist;
nearestHalfEdgeIdx = halfEdgeIdx;
found = true;
Expand All @@ -551,8 +547,9 @@ std::vector<glm::mat4x3> Manifold::surfaceMap(const std::vector<glm::mat4x3>& tr
currTf = MatrixTransforms::TranslateX(currTf, minDistance);
result.push_back(currTf);
currHalfedgeIdx = halfedges[nnextHalfedgeIdx].pairedHalfedge;
cout << "halfedge idx: " << currHalfedgeIdx << endl;
currManifoldDist += minDistance;
currTfIdx += 1;
currTf = transforms[currTfIdx];
} else {
cout << "next TF on current face" << endl;
cout << "currManifoldDist: " << currManifoldDist << " minDistance: " << minDistance << " currTfDist: " << currTfDist << endl;
Expand All @@ -564,6 +561,7 @@ std::vector<glm::mat4x3> Manifold::surfaceMap(const std::vector<glm::mat4x3>& tr
}
} while (currTfIdx < transforms.size() - 1);

result.push_back(transforms[transforms.size() - 1]);
for (auto& tf: result) {
cout << "tf pos: " << tf[3].x << " " << tf[3].y << " " << tf[3].z << endl;
}
Expand Down
4 changes: 3 additions & 1 deletion test/manifold_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ TEST(Manifold, surfaceMap) {
glm::mat4x3 transform1 = {{1, 0, 0}, {0, 0, 1}, {0, -1, 0}, {1.65, 0, 5}};
glm::mat4x3 transform2 = {{1, 0, 0}, {0, 0, 1}, {0, -1, 0}, {7.0, 0, 5}};
glm::mat4x3 transform3 = {{1, 0, 0}, {0, 0, 1}, {0, -1, 0}, {9.0, 0, 5}};
vector<glm::mat4x3> ret = cube.surfaceMap({transform1, transform2, transform3});
glm::mat4x3 transform4 = {{1, 0, 0}, {0, 0, 1}, {0, -1, 0}, {9.5, 0, 5}};
glm::mat4x3 transform5 = {{1, 0, 0}, {0, 0, 1}, {0, -1, 0}, {9.8, 0, 5}};
vector<glm::mat4x3> ret = cube.surfaceMap({transform1, transform2, transform3, transform4, transform5});
}

Polygons RotatePolygons(Polygons polys, const int index) {
Expand Down

0 comments on commit 8940811

Please sign in to comment.