Point Cloud Library (PCL)  1.9.1-dev
List of all members | Classes | Public Types | Public Member Functions | Public Attributes
pcl::MLSResult Struct Reference

Data structure used to store the results of the MLS fitting. More...

#include <pcl/surface/mls.h>

Classes

struct  MLSProjectionResults
 Data structure used to store the MLS projection results. More...
 
struct  PolynomialPartialDerivative
 Data structure used to store the MLS polynomial partial derivatives. More...
 

Public Types

enum  ProjectionMethod { NONE, SIMPLE, ORTHOGONAL }
 

Public Member Functions

 MLSResult ()
 
 MLSResult (const Eigen::Vector3d &a_query_point, const Eigen::Vector3d &a_mean, const Eigen::Vector3d &a_plane_normal, const Eigen::Vector3d &a_u, const Eigen::Vector3d &a_v, const Eigen::VectorXd &a_c_vec, const int a_num_neighbors, const float a_curvature, const int a_order)
 
void getMLSCoordinates (const Eigen::Vector3d &pt, double &u, double &v, double &w) const
 Given a point calculate it's 3D location in the MLS frame. More...
 
void getMLSCoordinates (const Eigen::Vector3d &pt, double &u, double &v) const
 Given a point calculate it's 2D location in the MLS frame. More...
 
double getPolynomialValue (const double u, const double v) const
 Calculate the polynomial. More...
 
PolynomialPartialDerivative getPolynomialPartialDerivative (const double u, const double v) const
 Calculate the polynomial's first and second partial derivatives. More...
 
Eigen::Vector2f calculatePrincipleCurvatures (const double u, const double v) const
 Calculate the principle curvatures using the polynomial surface. More...
 
MLSProjectionResults projectPointOrthogonalToPolynomialSurface (const double u, const double v, const double w) const
 Project a point orthogonal to the polynomial surface. More...
 
MLSProjectionResults projectPointToMLSPlane (const double u, const double v) const
 Project a point onto the MLS plane. More...
 
MLSProjectionResults projectPointSimpleToPolynomialSurface (const double u, const double v) const
 Project a point along the MLS plane normal to the polynomial surface. More...
 
MLSProjectionResults projectPoint (const Eigen::Vector3d &pt, ProjectionMethod method, int required_neighbors=0) const
 Project a point using the specified method. More...
 
MLSProjectionResults projectQueryPoint (ProjectionMethod method, int required_neighbors=0) const
 Project the query point used to generate the mls surface about using the specified method. More...
 
template<typename PointT >
void computeMLSSurface (const pcl::PointCloud< PointT > &cloud, int index, const std::vector< int > &nn_indices, double search_radius, int polynomial_order=2, boost::function< double(const double)> weight_func=0)
 Smooth a given point and its neighborghood using Moving Least Squares. More...
 

Public Attributes

Eigen::Vector3d query_point
 The query point about which the mls surface was generated. More...
 
Eigen::Vector3d mean
 The mean point of all the neighbors. More...
 
Eigen::Vector3d plane_normal
 The normal of the local plane of the query point. More...
 
Eigen::Vector3d u_axis
 The axis corresponding to the u-coordinates of the local plane of the query point. More...
 
Eigen::Vector3d v_axis
 The axis corresponding to the v-coordinates of the local plane of the query point. More...
 
Eigen::VectorXd c_vec
 The polynomial coefficients Example: z = c_vec[0] + c_vec[1]*v + c_vec[2]*v^2 + c_vec[3]*u + c_vec[4]*u*v + c_vec[5]*u^2. More...
 
int num_neighbors
 The number of neighbors used to create the mls surface. More...
 
float curvature
 The curvature at the query point. More...
 
int order
 The order of the polynomial. More...
 
bool valid
 If True, the mls results data is valid, otherwise False. More...
 

Detailed Description

Data structure used to store the results of the MLS fitting.

Definition at line 57 of file mls.h.

Member Enumeration Documentation

Enumerator
NONE 

Project to the mls plane.

SIMPLE 

Project along the mls plane normal to the polynomial surface.

ORTHOGONAL 

Project to the closest point on the polynonomial surface.

Definition at line 59 of file mls.h.

Constructor & Destructor Documentation

pcl::MLSResult::MLSResult ( )
inline
pcl::MLSResult::MLSResult ( const Eigen::Vector3d &  a_query_point,
const Eigen::Vector3d &  a_mean,
const Eigen::Vector3d &  a_plane_normal,
const Eigen::Vector3d &  a_u,
const Eigen::Vector3d &  a_v,
const Eigen::VectorXd &  a_c_vec,
const int  a_num_neighbors,
const float  a_curvature,
const int  a_order 
)
inline

Definition at line 434 of file mls.hpp.

Member Function Documentation

Eigen::Vector2f pcl::MLSResult::calculatePrincipleCurvatures ( const double  u,
const double  v 
) const
inline

Calculate the principle curvatures using the polynomial surface.

Parameters
[in]uThe u-coordinate of the point in local MLS frame.
[in]vThe v-coordinate of the point in local MLS frame.
Returns
The principle curvature [k1, k2] at the provided ub coordinates.
Note
If an error occurs the MLS_MINIMUM_PRINCIPLE_CURVATURE is returned.

Definition at line 533 of file mls.hpp.

References c_vec, getPolynomialPartialDerivative(), pcl::K, order, pcl::MLSResult::PolynomialPartialDerivative::z_u, pcl::MLSResult::PolynomialPartialDerivative::z_uu, pcl::MLSResult::PolynomialPartialDerivative::z_uv, pcl::MLSResult::PolynomialPartialDerivative::z_v, and pcl::MLSResult::PolynomialPartialDerivative::z_vv.

Referenced by MLSResult().

template<typename PointT >
void pcl::MLSResult::computeMLSSurface ( const pcl::PointCloud< PointT > &  cloud,
int  index,
const std::vector< int > &  nn_indices,
double  search_radius,
int  polynomial_order = 2,
boost::function< double(const double)>  weight_func = 0 
)

Smooth a given point and its neighborghood using Moving Least Squares.

Parameters
[in]indexthe index of the query point in the input cloud
[in]nn_indicesthe set of nearest neighbors indices for pt
[in]search_radiusthe search radius used to find nearest neighbors for pt
[in]polynomial_orderthe order of the polynomial to fit to the nearest neighbors
[in]weight_funcdefines the weight function for the polynomial fit

Definition at line 718 of file mls.hpp.

References c_vec, pcl::compute3DCentroid(), pcl::computeCovarianceMatrix(), curvature, pcl::eigen33(), pcl::EIGEN_ALIGN16, mean, num_neighbors, order, plane_normal, pcl::PointCloud< PointT >::points, query_point, u_axis, v_axis, and valid.

Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::computeMLSPointNormal(), and MLSResult().

void pcl::MLSResult::getMLSCoordinates ( const Eigen::Vector3d &  pt,
double &  u,
double &  v,
double &  w 
) const
inline

Given a point calculate it's 3D location in the MLS frame.

Parameters
[in]ptThe point
[out]uThe u-coordinate of the point in local MLS frame.
[out]vThe v-coordinate of the point in local MLS frame.
[out]wThe w-coordinate of the point in local MLS frame.

Definition at line 448 of file mls.hpp.

References mean, plane_normal, u_axis, and v_axis.

Referenced by MLSResult(), projectPoint(), and projectQueryPoint().

void pcl::MLSResult::getMLSCoordinates ( const Eigen::Vector3d &  pt,
double &  u,
double &  v 
) const
inline

Given a point calculate it's 2D location in the MLS frame.

Parameters
[in]ptThe point
[out]uThe u-coordinate of the point in local MLS frame.
[out]vThe v-coordinate of the point in local MLS frame.

Definition at line 457 of file mls.hpp.

References mean, u_axis, and v_axis.

pcl::MLSResult::PolynomialPartialDerivative pcl::MLSResult::getPolynomialPartialDerivative ( const double  u,
const double  v 
) const
inline

Calculate the polynomial's first and second partial derivatives.

Parameters
[in]uThe u-coordinate of the point in local MLS frame.
[in]vThe v-coordinate of the point in local MLS frame.
Returns
The polynomial partial derivatives at the provide uv coordinates.

Definition at line 488 of file mls.hpp.

References c_vec, order, pcl::MLSResult::PolynomialPartialDerivative::z, pcl::MLSResult::PolynomialPartialDerivative::z_u, pcl::MLSResult::PolynomialPartialDerivative::z_uu, pcl::MLSResult::PolynomialPartialDerivative::z_uv, pcl::MLSResult::PolynomialPartialDerivative::z_v, and pcl::MLSResult::PolynomialPartialDerivative::z_vv.

Referenced by calculatePrincipleCurvatures(), MLSResult(), projectPointOrthogonalToPolynomialSurface(), and projectPointSimpleToPolynomialSurface().

double pcl::MLSResult::getPolynomialValue ( const double  u,
const double  v 
) const
inline

Calculate the polynomial.

Parameters
[in]uThe u-coordinate of the point in local MLS frame.
[in]vThe v-coordinate of the point in local MLS frame.
Returns
The polynomial value at the provide uv coordinates.

Definition at line 465 of file mls.hpp.

References c_vec, and order.

Referenced by MLSResult().

pcl::MLSResult::MLSProjectionResults pcl::MLSResult::projectPoint ( const Eigen::Vector3d &  pt,
ProjectionMethod  method,
int  required_neighbors = 0 
) const
inline

Project a point using the specified method.

Parameters
[in]ptThe point to be project.
[in]methodThe projection method to be used.
[in]required_neighborsThe minimum number of neighbors required.
Note
If required_neighbors then any number of neighbors is allowed.
If required_neighbors is not satisfied it projects to the mls plane.
Returns
The MLSProjectionResults for the input data.

Definition at line 665 of file mls.hpp.

References c_vec, getMLSCoordinates(), NONE, num_neighbors, order, ORTHOGONAL, projectPointOrthogonalToPolynomialSurface(), projectPointSimpleToPolynomialSurface(), and projectPointToMLSPlane().

Referenced by MLSResult().

pcl::MLSResult::MLSProjectionResults pcl::MLSResult::projectPointOrthogonalToPolynomialSurface ( const double  u,
const double  v,
const double  w 
) const
inline

Project a point orthogonal to the polynomial surface.

Parameters
[in]uThe u-coordinate of the point in local MLS frame.
[in]vThe v-coordinate of the point in local MLS frame.
[in]wThe w-coordinate of the point in local MLS frame.
Returns
The MLSProjectionResults for the input data.
Note
If the MLSResults does not contain polynomial data it projects the point onto the mls plane.
If the optimization diverges it performs a simple projection on to the polynomial surface.
This was implemented based on this https://math.stackexchange.com/questions/1497093/shortest-distance-between-point-and-surface

Definition at line 565 of file mls.hpp.

References c_vec, getPolynomialPartialDerivative(), mean, pcl::MLSResult::MLSProjectionResults::normal, order, plane_normal, pcl::MLSResult::MLSProjectionResults::point, pcl::MLSResult::MLSProjectionResults::u, u_axis, pcl::MLSResult::MLSProjectionResults::v, v_axis, pcl::MLSResult::PolynomialPartialDerivative::z, pcl::MLSResult::PolynomialPartialDerivative::z_u, pcl::MLSResult::PolynomialPartialDerivative::z_uu, pcl::MLSResult::PolynomialPartialDerivative::z_uv, pcl::MLSResult::PolynomialPartialDerivative::z_v, and pcl::MLSResult::PolynomialPartialDerivative::z_vv.

Referenced by MLSResult(), projectPoint(), and projectQueryPoint().

pcl::MLSResult::MLSProjectionResults pcl::MLSResult::projectPointSimpleToPolynomialSurface ( const double  u,
const double  v 
) const
inline

Project a point along the MLS plane normal to the polynomial surface.

Parameters
[in]uThe u-coordinate of the point in local MLS frame.
[in]vThe v-coordinate of the point in local MLS frame.
Returns
The MLSProjectionResults for the input data.
Note
If the MLSResults does not contain polynomial data it projects the point onto the mls plane.

Definition at line 642 of file mls.hpp.

References c_vec, getPolynomialPartialDerivative(), mean, pcl::MLSResult::MLSProjectionResults::normal, order, plane_normal, pcl::MLSResult::MLSProjectionResults::point, pcl::MLSResult::MLSProjectionResults::u, u_axis, pcl::MLSResult::MLSProjectionResults::v, v_axis, pcl::MLSResult::PolynomialPartialDerivative::z, pcl::MLSResult::PolynomialPartialDerivative::z_u, and pcl::MLSResult::PolynomialPartialDerivative::z_v.

Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::computeMLSPointNormal(), MLSResult(), and projectPoint().

pcl::MLSResult::MLSProjectionResults pcl::MLSResult::projectPointToMLSPlane ( const double  u,
const double  v 
) const
inline

Project a point onto the MLS plane.

Parameters
[in]uThe u-coordinate of the point in local MLS frame.
[in]vThe v-coordinate of the point in local MLS frame.
Returns
The MLSProjectionResults for the input data.

Definition at line 630 of file mls.hpp.

References mean, pcl::MLSResult::MLSProjectionResults::normal, plane_normal, pcl::MLSResult::MLSProjectionResults::point, pcl::MLSResult::MLSProjectionResults::u, u_axis, pcl::MLSResult::MLSProjectionResults::v, and v_axis.

Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::computeMLSPointNormal(), MLSResult(), and projectPoint().

pcl::MLSResult::MLSProjectionResults pcl::MLSResult::projectQueryPoint ( ProjectionMethod  method,
int  required_neighbors = 0 
) const
inline

Project the query point used to generate the mls surface about using the specified method.

Parameters
[in]methodThe projection method to be used.
[in]required_neighborsThe minimum number of neighbors required.
Note
If required_neighbors then any number of neighbors is allowed.
If required_neighbors is not satisfied it projects to the mls plane.
Returns
The MLSProjectionResults for the input data.

Definition at line 687 of file mls.hpp.

References c_vec, getMLSCoordinates(), mean, NONE, pcl::MLSResult::MLSProjectionResults::normal, num_neighbors, order, ORTHOGONAL, plane_normal, pcl::MLSResult::MLSProjectionResults::point, projectPointOrthogonalToPolynomialSurface(), query_point, u_axis, and v_axis.

Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::computeMLSPointNormal(), and MLSResult().

Member Data Documentation

Eigen::VectorXd pcl::MLSResult::c_vec

The polynomial coefficients Example: z = c_vec[0] + c_vec[1]*v + c_vec[2]*v^2 + c_vec[3]*u + c_vec[4]*u*v + c_vec[5]*u^2.

Definition at line 217 of file mls.h.

Referenced by calculatePrincipleCurvatures(), computeMLSSurface(), getPolynomialPartialDerivative(), getPolynomialValue(), projectPoint(), projectPointOrthogonalToPolynomialSurface(), projectPointSimpleToPolynomialSurface(), and projectQueryPoint().

float pcl::MLSResult::curvature
Eigen::Vector3d pcl::MLSResult::mean
int pcl::MLSResult::num_neighbors

The number of neighbors used to create the mls surface.

Definition at line 218 of file mls.h.

Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::computeMLSPointNormal(), computeMLSSurface(), projectPoint(), and projectQueryPoint().

int pcl::MLSResult::order
Eigen::Vector3d pcl::MLSResult::plane_normal
Eigen::Vector3d pcl::MLSResult::query_point

The query point about which the mls surface was generated.

Definition at line 212 of file mls.h.

Referenced by computeMLSSurface(), and projectQueryPoint().

Eigen::Vector3d pcl::MLSResult::u_axis

The axis corresponding to the u-coordinates of the local plane of the query point.

Definition at line 215 of file mls.h.

Referenced by computeMLSSurface(), getMLSCoordinates(), projectPointOrthogonalToPolynomialSurface(), projectPointSimpleToPolynomialSurface(), projectPointToMLSPlane(), and projectQueryPoint().

Eigen::Vector3d pcl::MLSResult::v_axis

The axis corresponding to the v-coordinates of the local plane of the query point.

Definition at line 216 of file mls.h.

Referenced by computeMLSSurface(), getMLSCoordinates(), projectPointOrthogonalToPolynomialSurface(), projectPointSimpleToPolynomialSurface(), projectPointToMLSPlane(), and projectQueryPoint().

bool pcl::MLSResult::valid

If True, the mls results data is valid, otherwise False.

Definition at line 221 of file mls.h.

Referenced by computeMLSSurface().


The documentation for this struct was generated from the following files: