// Copyright 2020 The Manifold Authors.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314#pragma once15#include "impl.h"1617#ifdef MANIFOLD_DEBUG18#define PRINT(msg) \19if (ManifoldParams().verbose > 0) std::cout << msg << std::endl;20#else21#define PRINT(msg)22#endif2324/**25* The notation in these files is abbreviated due to the complexity of the26* functions involved. The key is that the input manifolds are P and Q, while27* the output is R, and these letters in both upper and lower case refer to28* these objects. Operations are based on dimensionality: vert: 0, edge: 1,29* face: 2, solid: 3. X denotes a winding-number type quantity from the source30* paper of this algorithm, while S is closely related but includes only the31* subset of X values which "shadow" (are on the correct side of).32*33* Nearly everything here are sparse arrays, where for instance each pair in34* p2q1 refers to a face index of P interacting with a halfedge index of Q.35* Adjacent arrays like x21 refer to the values of X corresponding to each36* sparse index pair.37*38* Note many functions are designed to work symmetrically, for instance for both39* p2q1 and p1q2. Inside of these functions P and Q are marked as though the40* function is forwards, but it may include a Boolean "reverse" that indicates P41* and Q have been swapped.42*/4344namespace manifold {45/** @ingroup Private */46class Boolean3 {47public:48Boolean3(const Manifold::Impl& inP, const Manifold::Impl& inQ, OpType op);49Manifold::Impl Result(OpType op) const;5051private:52const Manifold::Impl &inP_, &inQ_;53const double expandP_;54Vec<std::array<int, 2>> p1q2_, p2q1_;55Vec<int> x12_, x21_, w03_, w30_;56Vec<vec3> v12_, v21_;57bool valid = true;58};59} // namespace manifold606162