Skip to content

Commit

Permalink
propagate error for transform and compose
Browse files Browse the repository at this point in the history
  • Loading branch information
pca006132 committed Sep 19, 2024
1 parent 01437ee commit 7986564
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/manifold/src/csg_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ Manifold::Impl CsgLeafNode::Compose(
std::vector<int> propVertIndices;
int numPropOut = 0;
for (auto &node : nodes) {
if (node->pImpl_->status_ != Manifold::Error::NoError) {
Manifold::Impl impl;
impl.status_ = Manifold::Error::InvalidConstruction;
return impl;
}
double nodeOldScale = node->pImpl_->bBox_.Scale();
double nodeNewScale =
node->pImpl_->bBox_.Transform(node->transform_).Scale();
Expand Down Expand Up @@ -478,9 +483,9 @@ std::shared_ptr<Manifold::Impl> CsgOpNode::BatchBoolean(
continue;
}
group.run([&, a, b]() {
const Manifold::Impl *aImpl;
const Manifold::Impl *bImpl;
Boolean3 boolean(*getImplPtr(a), *getImplPtr(b), operation);
const Manifold::Impl *aImpl = getImplPtr(a);
const Manifold::Impl *bImpl = getImplPtr(b);
Boolean3 boolean(*aImpl, *bImpl, operation);
queue.emplace(
std::make_shared<Manifold::Impl>(boolean.Result(operation)));
return group.run(process);
Expand All @@ -507,11 +512,11 @@ std::shared_ptr<Manifold::Impl> CsgOpNode::BatchBoolean(
results.pop_back();
// boolean operation
Boolean3 boolean(*a, *b, operation);
auto result = std::make_shared<Manifold::Impl>(boolean.Result(operation));
if (results.size() == 0) {
return std::make_shared<Manifold::Impl>(boolean.Result(operation));
return result;
}
results.push_back(
std::make_shared<const Manifold::Impl>(boolean.Result(operation)));
results.push_back(result);
std::push_heap(results.begin(), results.end(), cmpFn);
}
return std::make_shared<Manifold::Impl>(*results.front());
Expand Down
4 changes: 4 additions & 0 deletions src/manifold/src/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ Manifold::Impl Manifold::Impl::Transform(const mat4x3& transform_) const {
if (transform_ == mat4x3(1.0)) return *this;
auto policy = autoPolicy(NumVert());
Impl result;
if (status_ != Manifold::Error::NoError) {
result.status_ = status_;
return result;
}
result.collider_ = collider_;
result.meshRelation_ = meshRelation_;
result.precision_ = precision_;
Expand Down

0 comments on commit 7986564

Please sign in to comment.