35 CCVector3* nearestPoint =
nullptr)
const override {
59 :
LocalModel(center, squaredRadius), m_tri(tri) {
72 CCVector3* nearestPoint =
nullptr)
const override {
75 m_tri->placeIteratorAtBeginning();
76 unsigned numberOfTriangles = m_tri->size();
78 for (
unsigned i = 0; i < numberOfTriangles; ++i) {
83 nearestPoint ? &triNearestPoint :
nullptr);
84 if (dist2 < minDist2 || i == 0) {
87 if (nearestPoint) *nearestPoint = triNearestPoint;
93 assert(minDist2 == minDist2);
95 return sqrt(minDist2);
120 m_gravityCenter(gravityCenter) {
130 CCVector3* nearestPoint =
nullptr)
const override {
135 m_eq[0] + m_eq[1] * P.
u[m_X] + m_eq[2] * P.
u[m_Y] +
136 m_eq[3] * P.
u[m_X] * P.
u[m_X] + m_eq[4] * P.
u[m_X] * P.
u[m_Y] +
137 m_eq[5] * P.
u[m_Y] * P.
u[m_Y];
140 nearestPoint->u[m_X] = P.
u[m_X];
141 nearestPoint->u[m_Y] = P.
u[m_Y];
142 nearestPoint->u[m_Z] = z;
145 return static_cast<ScalarType
>(
std::abs(P.
u[m_Z] - z));
163 : m_modelCenter(center), m_squaredRadius(squaredRadius) {}
177 return new LSLocalModel(lsPlane, center, squaredRadius);
182 std::string errorStr;
200 eq, dims.
x, dims.
y, dims.
z,
204 center, squaredRadius);
constexpr ScalarType NAN_VALUE
NaN as a ScalarType value.
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Delaunay 2D1/2 "local modelization".
ScalarType computeDistanceFromModelToPoint(const CCVector3 *P, CCVector3 *nearestPoint=nullptr) const override
Compute the (unsigned) distance between a 3D point and this model.
~DelaunayLocalModel() override
Destructor.
CV_LOCAL_MODEL_TYPES getType() const override
Returns the model type.
GenericMesh * m_tri
Associated triangulation.
DelaunayLocalModel(GenericMesh *tri, const CCVector3 ¢er, PointCoordinateType squaredRadius)
Constructor.
Least Squares Best Fitting Plane "local modelization".
LSLocalModel(const PointCoordinateType eq[4], const CCVector3 ¢er, PointCoordinateType squaredRadius)
Constructor.
CV_LOCAL_MODEL_TYPES getType() const override
Returns the model type.
ScalarType computeDistanceFromModelToPoint(const CCVector3 *P, CCVector3 *nearestPoint=nullptr) const override
Compute the (unsigned) distance between a 3D point and this model.
Quadric "local modelization".
unsigned char m_Y
Height function second dimension (0=X, 1=Y, 2=Z)
unsigned char m_X
Height function first dimension (0=X, 1=Y, 2=Z)
QuadricLocalModel(const PointCoordinateType eq[6], unsigned char X, unsigned char Y, unsigned char Z, CCVector3 gravityCenter, const CCVector3 ¢er, PointCoordinateType squaredRadius)
Constructor.
CV_LOCAL_MODEL_TYPES getType() const override
Returns the model type.
CCVector3 m_gravityCenter
Model gravity center.
ScalarType computeDistanceFromModelToPoint(const CCVector3 *_P, CCVector3 *nearestPoint=nullptr) const override
Compute the (unsigned) distance between a 3D point and this model.
unsigned char m_Z
Height function third dimension (0=X, 1=Y, 2=Z)
A generic triangle interface.
Local modelization (generic interface)
LocalModel(const CCVector3 ¢er, PointCoordinateType squaredRadius)
Constructor.
static LocalModel * New(CV_LOCAL_MODEL_TYPES type, Neighbourhood &subset, const CCVector3 ¢er, PointCoordinateType squaredRadius)
Factory.
const PointCoordinateType * getQuadric(Tuple3ub *dims=nullptr)
Returns the best interpolating 2.5D quadric.
const PointCoordinateType * getLSPlane()
Returns best interpolating plane equation (Least-square)
static constexpr bool DUPLICATE_VERTICES
const CCVector3 * getGravityCenter()
Returns gravity center.
static constexpr int IGNORE_MAX_EDGE_LENGTH
GenericIndexedMesh * triangulateOnPlane(bool duplicateVertices, PointCoordinateType maxEdgeLength, std::string &outputErrorStr)
Applies 2D Delaunay triangulation.
__host__ __device__ int2 abs(int2 v)
static double dist(double x1, double y1, double x2, double y2)
Generic file read and write utility for python interface.