Skip to content

Commit

Permalink
fix compose index error
Browse files Browse the repository at this point in the history
  • Loading branch information
pca006132 committed May 12, 2023
1 parent 1615b72 commit 1b7d369
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/manifold/src/csg_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ Manifold::Impl CsgLeafNode::Compose(
const bool invert = glm::determinant(glm::mat3(node->transform_)) < 0;
for_each_n(
policy,
zip(combined.halfedgeTangent_.begin(), countAt(edgeIndices[i])),
zip(combined.halfedgeTangent_.begin() + edgeIndices[i], countAt(0)),
node->pImpl_->halfedgeTangent_.size(),
TransformTangents{glm::mat3(node->transform_), invert,
node->pImpl_->halfedgeTangent_.cptrD(),
Expand Down
9 changes: 9 additions & 0 deletions test/manifold_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,3 +1088,12 @@ TEST(Manifold, Invalid) {
EXPECT_EQ(Manifold::Extrude(empty_circ, 10.).Status(), invalid);
EXPECT_EQ(Manifold::Revolve(empty_sq).Status(), invalid);
}

TEST(Manifold, MultiCompose) {
auto legAssembly = Manifold::Compose({Manifold::Cube({100, 140, 38})});
auto finalAssembly = Manifold::Compose(
{legAssembly, legAssembly.Translate({0, 300, 0}),
legAssembly.Mirror({1, 0, 0}).Translate({300, 0, 0}),
legAssembly.Mirror({1, 0, 0}).Translate({300, 300, 0})});
finalAssembly.GetMesh();
}

0 comments on commit 1b7d369

Please sign in to comment.