MeshLib C++ Docs
Loading...
Searching...
No Matches
MRFixUndercuts.h
Go to the documentation of this file.
1#pragma once
2#include "MRVoxelsFwd.h"
3
4#include "MRMesh/MRVector3.h"
5#include "MRMesh/MRVector2.h"
7#include "MRMesh/MRExpected.h"
8#include <functional>
9
10namespace MR
11{
14
15namespace FixUndercuts
16{
27[[deprecated( "Use fix( mesh, params )" )]]
28MRVOXELS_API MR_BIND_IGNORE Expected<void> fixUndercuts( Mesh& mesh, const Vector3f& upDirection, float voxelSize = 0.0f, float bottomExtension = 0.0f );
29
40[[deprecated( "Use fix( mesh, params )" )]]
41MRVOXELS_API MR_BIND_IGNORE Expected<void> fixUndercuts( Mesh& mesh, const FaceBitSet& selectedArea, const Vector3f& upDirection, float voxelSize = 0.0f, float bottomExtension = 0.0f );
42
45{
47 Vector3f upDirection;
48
53 float wallAngle = 0.0f;
54};
55
58{
61
63 float voxelSize = 0.0f;
64
66 float bottomExtension = 0.0f;
67
69 const FaceBitSet* region = nullptr;
70
72 bool smooth = false;
73
74 ProgressCallback cb;
75};
76
79MRVOXELS_API Expected<void> fix( Mesh& mesh, const FixParams& params );
80
83using UndercutMetric = std::function<double( const FaceBitSet&, const FindParams& params )>;
84
86[[nodiscard]] MRVOXELS_API UndercutMetric getUndercutAreaMetric( const Mesh& mesh );
87
89[[nodiscard]] MRVOXELS_API UndercutMetric getUndercutAreaProjectionMetric( const Mesh& mesh );
90
92[[deprecated( "Use find( mesh, params)" )]]
93MRVOXELS_API MR_BIND_IGNORE void findUndercuts( const Mesh& mesh, const Vector3f& upDirection, FaceBitSet& outUndercuts );
95[[deprecated( "Use find( mesh, params )" )]]
96MRVOXELS_API MR_BIND_IGNORE void findUndercuts( const Mesh& mesh, const Vector3f& upDirection, VertBitSet& outUndercuts );
97
100[[deprecated( "Use find( mesh, params, metric )" )]]
101[[nodiscard]] MRVOXELS_API MR_BIND_IGNORE double findUndercuts( const Mesh& mesh, const Vector3f& upDirection, FaceBitSet& outUndercuts, const UndercutMetric& metric );
102
105MRVOXELS_API double find( const Mesh& mesh, const FindParams& params, FaceBitSet& outUndercuts, const UndercutMetric& metric = {} );
107MRVOXELS_API void find( const Mesh& mesh, const FindParams& params, VertBitSet& outUndercuts );
108
112[[nodiscard]] MRVOXELS_API double scoreUndercuts( const Mesh& mesh, const Vector3f& upDirection, const Vector2i& resolution );
113
115{
119 float baseAngleStep{5.0f*PI_F / 180.0f};
121 float maxBaseAngle{30.0f*PI_F / 180.0f};
123 float polarAngleStep{20.0f*PI_F / 180.0f};
124};
125
131
141[[nodiscard]] MRVOXELS_API Vector3f improveDirection( const Mesh& mesh, const ImproveDirectionParameters& params, const UndercutMetric& metric );
144[[nodiscard]] MRVOXELS_API Vector3f distMapImproveDirection( const Mesh& mesh, const DistMapImproveDirectionParameters& params );
145}
146}
float bottomExtension
minimum extension of bottom part of the mesh
Definition MRFixUndercuts.h:66
float wallAngle
Definition MRFixUndercuts.h:53
MRVOXELS_API double scoreUndercuts(const Mesh &mesh, const Vector3f &upDirection, const Vector2i &resolution)
MRVOXELS_API Vector3f distMapImproveDirection(const Mesh &mesh, const DistMapImproveDirectionParameters &params)
ProgressCallback cb
Definition MRFixUndercuts.h:74
MRVOXELS_API UndercutMetric getUndercutAreaMetric(const Mesh &mesh)
returns the metric that computes total area of undercut faces
MRVOXELS_API Vector3f improveDirection(const Mesh &mesh, const ImproveDirectionParameters &params, const UndercutMetric &metric)
float maxBaseAngle
Maximum radial line given in radians look improveDirection comment.
Definition MRFixUndercuts.h:121
float voxelSize
voxel size for internal computations: lower size - better precision but more system resources require...
Definition MRFixUndercuts.h:63
tl::expected< T, E > Expected
Definition MRExpected.h:31
MRVOXELS_API Expected< void > fix(Mesh &mesh, const FixParams &params)
Vector2i distanceMapResolution
Resolution of distance map, lower it is, faster score works.
Definition MRFixUndercuts.h:129
bool smooth
if true applies one iterations of gaussian filtering for voxels, useful if thin walls expected
Definition MRFixUndercuts.h:72
MRVOXELS_API double find(const Mesh &mesh, const FindParams &params, FaceBitSet &outUndercuts, const UndercutMetric &metric={})
Vector3f hintDirection
Hint direction which will be improved.
Definition MRFixUndercuts.h:117
MRVOXELS_API UndercutMetric getUndercutAreaProjectionMetric(const Mesh &mesh)
returns the metric that computes summed absolute projected area of undercut
float polarAngleStep
Polar angle step.
Definition MRFixUndercuts.h:123
float baseAngleStep
Radial step given in radians look improveDirection comment.
Definition MRFixUndercuts.h:119
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
Vector3f upDirection
Primitives that are not visible from up direction are considered as undercuts (fix undercuts is perfo...
Definition MRFixUndercuts.h:47
MRVOXELS_API MR_BIND_IGNORE void findUndercuts(const Mesh &mesh, const Vector3f &upDirection, FaceBitSet &outUndercuts)
Adds to.
MRVOXELS_API MR_BIND_IGNORE Expected< void > fixUndercuts(Mesh &mesh, const Vector3f &upDirection, float voxelSize=0.0f, float bottomExtension=0.0f)
std::function< double(const FaceBitSet &, const FindParams &params)> UndercutMetric
Definition MRFixUndercuts.h:83
FindParams findParameters
parameters of what is considered as undercut
Definition MRFixUndercuts.h:60
const FaceBitSet * region
if set - only this region will be fixed (but still all mesh will be rebuild)
Definition MRFixUndercuts.h:69
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Parameters that is used to find undercuts.
Definition MRFixUndercuts.h:45
Fix undercuts function parameters.
Definition MRFixUndercuts.h:58
Definition MRFixUndercuts.h:115
Definition MRMesh.h:23