// Copyright 2021 The Manifold Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "./impl.h" #include <algorithm> #include <atomic> #include <map> #include "./hashtable.h" #include "./mesh_fixes.h" #include "./parallel.h" #include "./svd.h" namespace { usingnamespacemanifold; constexpr uint64_t kRemove = …; void AtomicAddVec3(vec3& target, const vec3& add) { … } struct Transform4x3 { … }; template <bool calculateTriNormal> struct AssignNormals { … }; struct UpdateMeshID { … }; struct CoplanarEdge { … }; struct CheckCoplanarity { … }; int GetLabels(std::vector<int>& components, const Vec<std::pair<int, int>>& edges, int numNodes) { … } void DedupePropVerts(manifold::Vec<ivec3>& triProp, const Vec<std::pair<int, int>>& vert2vert) { … } } // namespace namespace manifold { std::atomic<uint32_t> Manifold::Impl::meshIDCounter_(1); uint32_t Manifold::Impl::ReserveIDs(uint32_t n) { … } /** * Create either a unit tetrahedron, cube or octahedron. The cube is in the * first octant, while the others are symmetric about the origin. */ Manifold::Impl::Impl(Shape shape, const mat3x4 m) { … } void Manifold::Impl::RemoveUnreferencedVerts() { … } void Manifold::Impl::InitializeOriginal(bool keepFaceID) { … } void Manifold::Impl::CreateFaces() { … } /** * Create the halfedge_ data structure from an input triVerts array like Mesh. */ void Manifold::Impl::CreateHalfedges(const Vec<ivec3>& triVerts) { … } /** * Does a full recalculation of the face bounding boxes, including updating * the collider, but does not resort the faces. */ void Manifold::Impl::Update() { … } void Manifold::Impl::MarkFailure(Error status) { … } void Manifold::Impl::Warp(std::function<void(vec3&)> warpFunc) { … } void Manifold::Impl::WarpBatch(std::function<void(VecView<vec3>)> warpFunc) { … } Manifold::Impl Manifold::Impl::Transform(const mat3x4& transform_) const { … } /** * Sets epsilon based on the bounding box, and limits its minimum value * by the optional input. */ void Manifold::Impl::SetEpsilon(double minEpsilon, bool useSingle) { … } /** * If face normals are already present, this function uses them to compute * vertex normals (angle-weighted pseudo-normals); otherwise it also computes * the face normals. Face normals are only calculated when needed because * nearly degenerate faces will accrue rounding error, while the Boolean can * retain their original normal, which is more accurate and can help with * merging coplanar faces. * * If the face normals have been invalidated by an operation like Warp(), * ensure you do faceNormal_.resize(0) before calling this function to force * recalculation. */ void Manifold::Impl::CalculateNormals() { … } /** * Remaps all the contained meshIDs to new unique values to represent new * instances of these meshes. */ void Manifold::Impl::IncrementMeshIDs() { … } /** * Returns a sparse array of the bounding box overlaps between the edges of * the input manifold, Q and the faces of this manifold. Returned indices only * point to forward halfedges. */ SparseIndices Manifold::Impl::EdgeCollisions(const Impl& Q, bool inverted) const { … } /** * Returns a sparse array of the input vertices that project inside the XY * bounding boxes of the faces of this manifold. */ SparseIndices Manifold::Impl::VertexCollisionsZ(VecView<const vec3> vertsIn, bool inverted) const { … } } // namespace manifold