diff --git a/src/manifold/src/csg_tree.cpp b/src/manifold/src/csg_tree.cpp index ad58b5796..8a0ddd2cd 100644 --- a/src/manifold/src/csg_tree.cpp +++ b/src/manifold/src/csg_tree.cpp @@ -221,13 +221,13 @@ Manifold::Impl CsgLeafNode::Compose( combined.halfedge_.begin() + edgeIndices[i], UpdateHalfedge({vertIndices[i], edgeIndices[i], triIndices[i]})); const bool invert = glm::determinant(glm::mat3(node->transform_)) < 0; - for_each_n( - policy, - zip(combined.halfedgeTangent_.begin(), countAt(edgeIndices[i])), - node->pImpl_->halfedgeTangent_.size(), - TransformTangents{glm::mat3(node->transform_), invert, - node->pImpl_->halfedgeTangent_.cptrD(), - node->pImpl_->halfedge_.cptrD()}); + for_each_n(policy, + zip(combined.halfedgeTangent_.begin() + edgeIndices[i], + countAt(0)), + node->pImpl_->halfedgeTangent_.size(), + TransformTangents{glm::mat3(node->transform_), invert, + node->pImpl_->halfedgeTangent_.cptrD(), + node->pImpl_->halfedge_.cptrD()}); if (invert) for_each_n(policy, zip(combined.meshRelation_.triRef.begin(), diff --git a/test/manifold_test.cpp b/test/manifold_test.cpp index 37c600817..66052eeb0 100644 --- a/test/manifold_test.cpp +++ b/test/manifold_test.cpp @@ -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 part = Manifold::Compose({Manifold::Cube({10, 10, 10})}); + auto finalAssembly = + Manifold::Compose({part, part.Translate({0, 10, 0}), + part.Mirror({1, 0, 0}).Translate({10, 0, 0}), + part.Mirror({1, 0, 0}).Translate({10, 10, 0})}); + EXPECT_FLOAT_EQ(finalAssembly.GetProperties().volume, 4000); +}