/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __BLI_BOOLEAN_HH__ #define __BLI_BOOLEAN_HH__ /** \file * \ingroup bli */ # include "BLI_array.hh" # include "BLI_math_mpq.hh" # include "BLI_mesh_intersect.hh" # include "BLI_mpq3.hh" namespace blender { namespace meshintersect { /* Enum values after BOOLEAN_NONE need to match BMESH_ISECT_BOOLEAN_... values in editmesh_intersect.c. */ enum bool_optype { BOOLEAN_NONE = -1, /* Aligned with BooleanModifierOp. */ BOOLEAN_ISECT = 0, BOOLEAN_UNION = 1, BOOLEAN_DIFFERENCE = 2, }; struct PolyMeshOrig { Array vert_orig; Array> face_orig; Array>> edge_orig; }; struct PolyMesh { Array vert; Array> face; /* triangulation can have zero length: then boolean will do it. */ Array> triangulation; /* orig can be dummy for boolean input, but has useful information for its output. */ PolyMeshOrig orig; }; PolyMesh boolean(PolyMesh &pm, bool_optype op, int nshapes, std::function shape_fn); TriMesh boolean_trimesh(const TriMesh &tm, bool_optype op, int nshapes, std::function shape_fn); void write_obj_polymesh(const Array &vert, const Array> &face, const std::string &objname); } // namespace meshintersect } // namespace blender #endif /* __BLI_BOOLEAN_HH__ */