110template <
typename VolumeType = VdbVolume>
112 Mesh& mesh,
const AffineXf3f& meshXf,
113 const VolumeType& volume,
const AffineXf3f& volumeXf,
119 const VdbVolume& volume,
const AffineXf3f& volumeXf,
123 const SimpleVolumeMinMax& volume,
const AffineXf3f& volumeXf,
127 const FunctionVolume& volume,
const AffineXf3f& volumeXf,
135template <
typename MeshType,
typename VolumeType>
197 for (
auto it =
begin; it !=
end; ++it )
202 template <
size_t degree>
206 for (
size_t i = 0; i < values.size(); ++i )
207 bestFit.
addPoint( pseudoIndex(
int( i ),
int( values.size() ) ), values[i] );
216 const VolumeType& volume_;
220 AffineXf3f xf_, xfInv_;
#define MRVOXELS_API
Definition MRVoxels/MRVoxelsFwd.h:13
#define MRVOXELS_CLASS
Definition MRVoxels/MRVoxelsFwd.h:14
accumulates a number of (x,y) points to find the best-least-squares parabola approximating them
Definition MRBestFitParabola.h:12
Parabola< T > getBestParabola(T tol=std::numeric_limits< T >::epsilon()) const
computes the best approximating parabola from the accumulated points;
Definition MRBestFitParabola.h:45
void addPoint(T x, T y)
accumulates one more point for parabola fitting
Definition MRBestFitParabola.h:29
Definition MRBestFitPolynomial.h:95
MRMESH_API void addPoint(T x, T y)
MRMESH_API Polynomial< T, degree > getBestPolynomial() const
Definition MRMoveMeshToVoxelMaxDeriv.h:137
MRVOXELS_API MeshType & mesh() const
MRVOXELS_API int numVerts() const
MRVOXELS_API MeshOnVoxelsT(const MeshOnVoxelsT &other)
MRVOXELS_API Vector3f point(VertId v) const
MRVOXELS_API float voxelSize() const
static MRVOXELS_API float pseudoIndex(float index, int count)
MRVOXELS_API void getValues(std::vector< float > &result, const Vector3f &pos, const Vector3f &offset) const
MRVOXELS_API float getValue(const Vector3f &pos) const
static MRVOXELS_API void getDerivatives(std::vector< float > &result, const std::vector< float > &values)
MRVOXELS_API Vector3f xfInv(const Vector3f &pt) const
MRVOXELS_API Vector3f getOffsetVector(VertId v) const
MRVOXELS_API Vector3f xf(const Vector3f &pt) const
static Polynomialf< degree > getBestPolynomial(const std::vector< float > &values)
Definition MRMoveMeshToVoxelMaxDeriv.h:203
MRVOXELS_API const VolumeType & volume() const
static MRVOXELS_API float pseudoIndex(int index, int count)
static Parabolaf getBestParabola(auto begin, auto end)
Definition MRMoveMeshToVoxelMaxDeriv.h:193
MRVOXELS_API void getPoints(std::vector< Vector3f > &result, const Vector3f &pos, const Vector3f &offset) const
MRVOXELS_API MeshOnVoxelsT(MeshType &mesh, const AffineXf3f &meshXf, const VolumeType &volume, const AffineXf3f &volumeXf)
static MRVOXELS_API float indexFromPseudoIndex(float pseudoIndex, int count)
MRVOXELS_API AffineXf3f xfInv() const
MRVOXELS_API AffineXf3f xf() const
static MRVOXELS_API PolynomialWrapperf getBestPolynomial(const std::vector< float > &values, size_t degree)
helper class for generalized voxel volume data access
Definition MRVoxelsVolumeAccess.h:14
Definition MRVolumeInterpolation.h:18
MR_BIND_IGNORE auto begin(const BitSet &a)
Definition MRMesh/MRBitSet.h:295
MR_BIND_IGNORE auto end(const BitSet &)
Definition MRMesh/MRBitSet.h:297
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:626
MRVOXELS_API Expected< VertBitSet > moveMeshToVoxelMaxDeriv(Mesh &mesh, const AffineXf3f &meshXf, const VolumeType &volume, const AffineXf3f &volumeXf, const MoveMeshToVoxelMaxDerivSettings &settings, ProgressCallback callback={})
template MRVOXELS_API Expected< VertBitSet > moveMeshToVoxelMaxDeriv< SimpleVolumeMinMax >(Mesh &mesh, const AffineXf3f &meshXf, const SimpleVolumeMinMax &volume, const AffineXf3f &volumeXf, const MoveMeshToVoxelMaxDerivSettings &settings, ProgressCallback callback)
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:32
tl::expected< T, E > Expected
Definition MRExpected.h:59
template MRVOXELS_API Expected< VertBitSet > moveMeshToVoxelMaxDeriv< VdbVolume >(Mesh &mesh, const AffineXf3f &meshXf, const VdbVolume &volume, const AffineXf3f &volumeXf, const MoveMeshToVoxelMaxDerivSettings &settings, ProgressCallback callback)
template MRVOXELS_API Expected< VertBitSet > moveMeshToVoxelMaxDeriv< FunctionVolume >(Mesh &mesh, const AffineXf3f &meshXf, const FunctionVolume &volume, const AffineXf3f &volumeXf, const MoveMeshToVoxelMaxDerivSettings &settings, ProgressCallback callback)
Definition MRMesh/MRMesh.h:23
Definition MRMoveMeshToVoxelMaxDeriv.h:82
float intermediateSmoothForce
force of the smoothing (relaxation) of vector field of shifts on each iteration
Definition MRMoveMeshToVoxelMaxDeriv.h:99
float preparationSmoothForce
force of initial smoothing of vertices, before applying the algorithm
Definition MRMoveMeshToVoxelMaxDeriv.h:102
float outlierThreshold
Definition MRMoveMeshToVoxelMaxDeriv.h:96
int iters
number of iterations. Each iteration moves vertex only slightly and smooths the vector field of shift...
Definition MRMoveMeshToVoxelMaxDeriv.h:84
int samplePoints
Definition MRMoveMeshToVoxelMaxDeriv.h:88
int degree
degree of the polynomial used to fit sampled points. Must be in range [3; 6]
Definition MRMoveMeshToVoxelMaxDeriv.h:91
This is a unifying interface for a polynomial of some degree, known only in runtime.
Definition MRBestFitPolynomial.h:74
Definition MRBestFitPolynomial.h:32