// Copyright 2024 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 "./parallel.h" template <> struct std::hash<manifold::ivec4> { … }; namespace { usingnamespacemanifold; class Partition { … }; } // namespace namespace manifold { /** * Returns the tri side index (0-2) connected to the other side of this quad if * this tri is part of a quad, or -1 otherwise. */ int Manifold::Impl::GetNeighbor(int tri) const { … } /** * For the given triangle index, returns either the three halfedge indices of * that triangle and halfedges[3] = -1, or if the triangle is part of a quad, it * returns those four indices. If the triangle is part of a quad and is not the * lower of the two triangle indices, it returns all -1s. */ ivec4 Manifold::Impl::GetHalfedges(int tri) const { … } /** * Returns the BaryIndices, which gives the tri and indices (0-3), such that * GetHalfedges(val.tri)[val.start4] points back to this halfedge, and val.end4 * will point to the next one. This function handles this for both triangles and * quads. Returns {-1, -1, -1} if the edge is the interior of a quad. */ Manifold::Impl::BaryIndices Manifold::Impl::GetIndices(int halfedge) const { … } /** * Retained verts are part of several triangles, and it doesn't matter which one * the vertBary refers to. Here, whichever is last will win and it's done on the * CPU for simplicity for now. Using AtomicCAS on .tri should work for a GPU * version if desired. */ void Manifold::Impl::FillRetainedVerts(Vec<Barycentric>& vertBary) const { … } /** * Split each edge into n pieces as defined by calling the edgeDivisions * function, and sub-triangulate each triangle accordingly. This function * doesn't run Finish(), as that is expensive and it'll need to be run after * the new vertices have moved, which is a likely scenario after refinement * (smoothing). */ Vec<Barycentric> Manifold::Impl::Subdivide( std::function<int(vec3, vec4, vec4)> edgeDivisions, bool keepInterior) { … } } // namespace manifold