Debian Codegraph @

thirdparty/manifold/src/boolean3.h

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