MeshLib C++ Docs
Loading...
Searching...
No Matches
MRConeApproximator.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRCone3.h"
5#include "MRPch/MREigenCore.h"
6
7namespace MR
8{
11
12
19
26
31template <typename T>
33{
34public:
35
36 Cone3Approximation() = default;
37
39 MRMESH_API T solve( const std::vector<MR::Vector3<T>>& points,
40 Cone3<T>& cone, const Cone3ApproximationParams& params = {} );
41
42private:
43
46
48 T solveFixedAxis_( const std::vector<MR::Vector3<T>>& points,
49 Cone3<T>& cone, bool useConeInputAsInitialGuess = false );
50
51 T solveApproximationPCM_( const std::vector<MR::Vector3<T>>& points, Cone3<T>& cone );
52
53 T solveSpecificAxisFit_( const std::vector<MR::Vector3<T>>& points, Cone3<T>& cone );
54
56 T solveHemisphereSearchFit_( const std::vector<MR::Vector3<T>>& points, Cone3<T>& cone );
57
59 T calculateConeHeight_( const std::vector<MR::Vector3<T>>& points, Cone3<T>& cone );
60
61 T getApproximationRMS_( const std::vector<MR::Vector3<T>>& points, const Cone3<T>& cone );
62
63 MR::Vector3<T> computeCenter_( const std::vector<MR::Vector3<T>>& points );
64
65 void computeCenterAndNormal_( const std::vector<MR::Vector3<T>>& points, MR::Vector3<T>& center, MR::Vector3<T>& U );
66
68 Cone3<T> computeInitialCone_( const std::vector<MR::Vector3<T>>& points, const MR::Vector3<T>& center, const MR::Vector3<T>& axis );
69
71 void findBestFitLine_( const std::vector<MR::Vector2<T>>& xyPairs, T& lineA, T& lineB, MR::Vector2<T>* avg = nullptr );
72
74 void fitParamsToCone_( Eigen::Vector<T, Eigen::Dynamic>& fittedParams, Cone3<T>& cone );
75
77 void coneToFitParams_( Cone3<T>& cone, Eigen::Vector<T, Eigen::Dynamic>& fittedParams );
78};
79
80}
#define MRMESH_API
Definition MRMeshFwd.h:85
Base class for cone parameterization.
Definition MRCone3.h:14
int hemisphereSearchThetaResolution
Definition MRConeApproximator.h:24
ConeFitterType
Definition MRConeApproximator.h:14
int hemisphereSearchPhiResolution
Definition MRConeApproximator.h:23
int levenbergMarquardtMaxIteration
Definition MRConeApproximator.h:21
ConeFitterType coneFitterType
Definition MRConeApproximator.h:22
T solve(const std::vector< MR::Vector3< T > > &points, Cone3< T > &cone, const Cone3ApproximationParams &params={})
returns RMS for original points
Cone3Approximation()=default
@ HemisphereSearchFit
approximation of cone axis by principal component method
Definition MRConeApproximator.h:16
@ SpecificAxisFit
Definition MRConeApproximator.h:17
@ ApproximationPCM
Definition MRConeApproximator.h:15
Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
Definition MRCameraOrientationPlugin.h:8
Definition MRConeApproximator.h:20
Definition MRVector2.h:29
Definition MRVector3.h:33