MeshLib Documentation
Loading...
Searching...
No Matches
MRMeshThickness.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRMeshProject.h"
5#include <cfloat>
6#include <optional>
7
8namespace MR
9{
10
12[[nodiscard]] MRMESH_API std::optional<VertScalars> computeRayThicknessAtVertices( const Mesh& mesh, const ProgressCallback & progress = {} );
13[[deprecated]] MRMESH_API VertScalars computeThicknessAtVertices( const Mesh& mesh );
14
17{
19 Vector3f pt;
20 Vector3f inDir;
22
23 MRMESH_API void set( const Mesh& mesh, const MeshTriPoint & p );
24};
25
27[[nodiscard]] MRMESH_API MeshIntersectionResult rayInsideIntersect( const Mesh& mesh, const MeshPoint & m, float rayEnd = FLT_MAX );
28[[nodiscard]] MRMESH_API MeshIntersectionResult rayInsideIntersect( const Mesh& mesh, VertId v, float rayEnd = FLT_MAX );
29
30// Shrinking sphere: A parallel algorithm for computing the thickness of 3D objects
31// https://www.cad-journal.net/files/vol_13/CAD_13(2)_2016_199-207.pdf
32
35{
39 bool insideAndOutside = false;
40
43 float maxRadius = 1;
44
46 int maxIters = 16;
47
49 float minShrinkage = 0.99999f;
50};
51
59
61[[nodiscard]] MRMESH_API InSphere findInSphere( const Mesh& mesh, const MeshPoint & m, const InSphereSearchSettings & settings );
62[[nodiscard]] MRMESH_API InSphere findInSphere( const Mesh& mesh, VertId v, const InSphereSearchSettings & settings );
63
65[[nodiscard]] MRMESH_API std::optional<VertScalars> computeInSphereThicknessAtVertices( const Mesh& mesh,
66 const InSphereSearchSettings & settings, const ProgressCallback & progress = {} );
67
68} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:576
Definition MRCameraOrientationPlugin.h:8
MRMESH_API InSphere findInSphere(const Mesh &mesh, const MeshPoint &m, const InSphereSearchSettings &settings)
finds maximal sphere inscribed in the mesh touching point (p) with center along the normal at (p)
std::function< bool(FaceId)> FacePredicate
Definition MRMesh/MRMeshFwd.h:423
MRMESH_API std::optional< VertScalars > computeInSphereThicknessAtVertices(const Mesh &mesh, const InSphereSearchSettings &settings, const ProgressCallback &progress={})
returns the thickness at each vertex as the diameter of the maximal inscribed sphere
MRMESH_API VertScalars computeThicknessAtVertices(const Mesh &mesh)
MRMESH_API std::optional< VertScalars > computeRayThicknessAtVertices(const Mesh &mesh, const ProgressCallback &progress={})
returns the distance from each vertex along minus normal to the nearest mesh intersection (or FLT_MAX...
MRMESH_API MeshIntersectionResult rayInsideIntersect(const Mesh &mesh, const MeshPoint &m, float rayEnd=FLT_MAX)
returns the nearest intersection between the mesh and the ray from given point along minus normal (in...
controls the finding of maximal inscribed sphere in mesh
Definition MRMeshThickness.h:35
bool insideAndOutside
Definition MRMeshThickness.h:39
int maxIters
maximum number of shrinking iterations for one triangle
Definition MRMeshThickness.h:46
float minShrinkage
iterations stop if next radius is larger than minShrinkage times previous radius
Definition MRMeshThickness.h:49
float maxRadius
Definition MRMeshThickness.h:43
found maximal inscribed sphere touching input point with center along given direction
Definition MRMeshThickness.h:54
float radius
Definition MRMeshThickness.h:56
MeshProjectionResult oppositeTouchPoint
excluding input point and incident triangles, distSq - squared distance to sphere's center
Definition MRMeshThickness.h:57
Vector3f center
Definition MRMeshThickness.h:55
Definition MRMeshIntersect.h:17
describes the point of measurement on mesh
Definition MRMeshThickness.h:17
MRMESH_API void set(const Mesh &mesh, const MeshTriPoint &p)
Vector3f pt
3d coordinates
Definition MRMeshThickness.h:19
MeshTriPoint triPoint
relative position on mesh
Definition MRMeshThickness.h:18
FacePredicate notIncidentFaces
predicate that returns true for mesh faces not-incident to the point
Definition MRMeshThickness.h:21
Vector3f inDir
unit direction inside the mesh = minus normal
Definition MRMeshThickness.h:20
Definition MRMesh/MRMeshProject.h:18
Definition MRMesh/MRMeshTriPoint.h:23
Definition MRMesh/MRMesh.h:23