Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BLI_mesh_inset.hh « blenlib « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 599ea061b2e580b69cb35a1130f1a381c5042c77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* SPDX-License-Identifier: GPL-2.0-or-later */

#pragma once

/** \file
 * \ingroup bli
 *
 * This header file contains a C++ interface to a 3D mesh inset algorithm
 * which is based on a 2D Straight Skeleton construction.
 */

#include "BLI_array.hh"
#include "BLI_math_vec_types.hh"
#include "BLI_span.hh"
#include "BLI_vector.hh"


namespace blender::meshinset {

class MeshInset_Input {
public:
  /** The vertices. Can be a superset of the needed vertices. */
  Span<float3> vert;
  /** The faces, each a CCW ordering of vertex indices. */
  Span<Vector<int>> face;
  /** The contours to inset; ints are vert indices; contour is on left side of implied edges. */
  Span<Vector<int>> contour;
  float inset_amount;
  float slope;
  bool need_ids;
};

class MeshInset_Result {
public:
  /** The output vertices. A subset (perhaps) of input vertices, plus some new ones. */
  Array<float3> vert;
  /** The output faces, each a CCW ordering of the output vertices. */
  Array<Vector<int>> face;
  /** The output contours -- where the input contours ended up. */
  Array<Vector<int>> contour;
  /** Maps output vertex indices to input vertex indices, -1 if there is none. */
  Array<int> orig_vert;
  /** Maps output faces tot input faces that they were part of. */
  Array<int> orig_face;
};

MeshInset_Result mesh_inset_calc(const MeshInset_Input &input);

}  // namespace blender::meshinset