112template <
typename VolumeType = VdbVolume>
114 Mesh& mesh,
const AffineXf3f& meshXf,
115 const VolumeType&
volume,
const AffineXf3f& volumeXf,
121 const VdbVolume&
volume,
const AffineXf3f& volumeXf,
137template <
typename MeshType,
typename VolumeType>
199 for (
auto it =
begin; it !=
end; ++it )
204 template <
size_t degree>
208 for (
size_t i = 0; i < values.size(); ++i )
218 const VolumeType& volume_;
222 AffineXf3f xf_, xfInv_;
#define MRVOXELS_API
see explanation in MRMesh/MRMeshFwd.h
Definition MRVoxelsFwd.h:14
#define MRVOXELS_CLASS
Definition MRVoxelsFwd.h:18
accumulates a number of (x,y) points to find the best-least-squares parabola approximating them
Definition MRBestFitParabola.h:15
Definition MRBestFitPolynomial.h:98
Definition MRMoveMeshToVoxelMaxDeriv.h:139
int numVerts() const
Cached number of valid vertices.
void getPoints(std::vector< Vector3f > &result, const Vector3f &pos, const Vector3f &offset) const
Get row of points with offset stride.
static PolynomialWrapperf getBestPolynomial(const std::vector< float > &values, size_t degree)
Vector3f getOffsetVector(VertId v) const
Get offset vector (mesh normal for a vertex with voxelSize length)
Vector3f xfInv(const Vector3f &pt) const
Vector3f point(VertId v) const
Vertex position.
static float indexFromPseudoIndex(float pseudoIndex, int count)
void getValues(std::vector< float > &result, const Vector3f &pos, const Vector3f &offset) const
Get volume values for a row of points.
static float pseudoIndex(float index, int count)
static Polynomialf< degree > getBestPolynomial(const std::vector< float > &values)
Definition MRMoveMeshToVoxelMaxDeriv.h:205
MeshOnVoxelsT(const MeshOnVoxelsT &other)
MeshOnVoxelsT(MeshType &mesh, const AffineXf3f &meshXf, const VolumeType &volume, const AffineXf3f &volumeXf)
static void getDerivatives(std::vector< float > &result, const std::vector< float > &values)
Get derivatives from result of getValues
static Parabolaf getBestParabola(auto begin, auto end)
Get best fit parabola in pseudo-index space for a zero-centered array.
Definition MRMoveMeshToVoxelMaxDeriv.h:195
float getValue(const Vector3f &pos) const
Volume value.
float voxelSize() const
Voxel size as scalar.
const VdbVolume & volume() const
Vector3f xf(const Vector3f &pt) const
static float pseudoIndex(int index, int count)
helper class for generalized voxel volume data access
Definition MRVoxelsVolumeAccess.h:17
Definition MRVolumeInterpolation.h:21
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:753
double volume(const MeshTopology &topology, const VertCoords &points, const FaceBitSet *region=nullptr)
Polynomial< T, degree > getBestPolynomial() const
MRVOXELS_CLASS SimpleVolumeMinMax
Definition MRVoxelsFwd.h:35
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:32
MRVOXELS_CLASS FunctionVolume
Definition MRVoxelsFwd.h:46
Parabola< T > getBestParabola(T tol=std::numeric_limits< T >::epsilon()) const
computes the best approximating parabola from the accumulated points;
Definition MRBestFitParabola.h:48
tl::expected< T, E > Expected
Definition MRExpected.h:31
void addPoint(T x, T y)
accumulates one more point for parabola fitting
Definition MRBestFitParabola.h:32
PolynomialWrapper< float > PolynomialWrapperf
Definition MRBestFitPolynomial.h:92
Parabolaf
Definition MRMeshFwd.h:356
Polynomial< float, degree > Polynomialf
Definition MRBestFitPolynomial.h:57
@ other
Angle, normally float. Measure in radians.
Definition MRFeatureObject.h:27
Expected< VertBitSet > moveMeshToVoxelMaxDeriv(Mesh &mesh, const AffineXf3f &meshXf, const VolumeType &volume, const AffineXf3f &volumeXf, const MoveMeshToVoxelMaxDerivSettings &settings, ProgressCallback callback={})
auto begin(ViewportMask mask)
Definition MRViewportId.h:122
auto end(ViewportMask)
Definition MRViewportId.h:124
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
MeshOnVoxelsT< Mesh, FunctionVolume > MeshOnVoxelsFunction
Definition MRMoveMeshToVoxelMaxDeriv.h:235
MeshOnVoxelsT< const Mesh, SimpleVolumeMinMax > MeshOnVoxelsSimpleC
Definition MRMoveMeshToVoxelMaxDeriv.h:233
MeshOnVoxelsT< const Mesh, FunctionVolume > MeshOnVoxelsFunctionC
Definition MRMoveMeshToVoxelMaxDeriv.h:236
template Expected< VertBitSet > moveMeshToVoxelMaxDeriv< VdbVolume >(Mesh &mesh, const AffineXf3f &meshXf, const VdbVolume &volume, const AffineXf3f &volumeXf, const MoveMeshToVoxelMaxDerivSettings &settings, ProgressCallback callback)
MeshOnVoxelsT< Mesh, VdbVolume > MeshOnVoxelsVdb
Definition MRMoveMeshToVoxelMaxDeriv.h:229
MeshOnVoxelsT< Mesh, SimpleVolumeMinMax > MeshOnVoxelsSimple
Definition MRMoveMeshToVoxelMaxDeriv.h:232
MeshOnVoxelsT< const Mesh, VdbVolume > MeshOnVoxelsVdbC
Definition MRMoveMeshToVoxelMaxDeriv.h:230
template Expected< VertBitSet > moveMeshToVoxelMaxDeriv< SimpleVolumeMinMax >(Mesh &mesh, const AffineXf3f &meshXf, const SimpleVolumeMinMax &volume, const AffineXf3f &volumeXf, const MoveMeshToVoxelMaxDerivSettings &settings, ProgressCallback callback)
template Expected< VertBitSet > moveMeshToVoxelMaxDeriv< FunctionVolume >(Mesh &mesh, const AffineXf3f &meshXf, const FunctionVolume &volume, const AffineXf3f &volumeXf, const MoveMeshToVoxelMaxDerivSettings &settings, ProgressCallback callback)
Definition MRMoveMeshToVoxelMaxDeriv.h:84
float intermediateSmoothForce
force of the smoothing (relaxation) of vector field of shifts on each iteration
Definition MRMoveMeshToVoxelMaxDeriv.h:101
float preparationSmoothForce
force of initial smoothing of vertices, before applying the algorithm
Definition MRMoveMeshToVoxelMaxDeriv.h:104
float outlierThreshold
Definition MRMoveMeshToVoxelMaxDeriv.h:98
int iters
number of iterations. Each iteration moves vertex only slightly and smooths the vector field of shift...
Definition MRMoveMeshToVoxelMaxDeriv.h:86
int samplePoints
Definition MRMoveMeshToVoxelMaxDeriv.h:90
int degree
degree of the polynomial used to fit sampled points. Must be in range [3; 6]
Definition MRMoveMeshToVoxelMaxDeriv.h:93