105 rf.setConstant (std::numeric_limits<float>::quiet_NaN ());
107 return (std::numeric_limits<float>::max ());
111 Eigen::Vector4d v1 = Eigen::Vector4d::Zero ();
112 Eigen::Vector4d v3 = Eigen::Vector4d::Zero ();
113 v1.head<3> ().matrix () = solver.eigenvectors ().col (2);
114 v3.head<3> ().matrix () = solver.eigenvectors ().col (0);
116 int plusNormal = 0, plusTangentDirection1=0;
117 for (
int ne = 0; ne < valid_nn_points; ne++)
119 double dp = vij.row (ne).dot (v1);
121 plusTangentDirection1++;
123 dp = vij.row (ne).dot (v3);
129 plusTangentDirection1 = 2*plusTangentDirection1 - valid_nn_points;
130 if (plusTangentDirection1 == 0)
133 int medianIndex = valid_nn_points/2;
135 for (
int i = -points/2; i <= points/2; i++)
136 if ( vij.row (medianIndex - i).dot (v1) > 0)
137 plusTangentDirection1 ++;
139 if (plusTangentDirection1 < points/2+1)
142 else if (plusTangentDirection1 < 0)
146 plusNormal = 2*plusNormal - valid_nn_points;
150 int medianIndex = valid_nn_points/2;
152 for (
int i = -points/2; i <= points/2; i++)
153 if ( vij.row (medianIndex - i).dot (v3) > 0)
156 if (plusNormal < points/2+1)
158 }
else if (plusNormal < 0)
161 rf.row (0).matrix () = v1.head<3> ().cast<float> ();
162 rf.row (2).matrix () = v3.head<3> ().cast<float> ();
163 rf.row (1).matrix () = rf.row (2).cross (rf.row (0));
169template <
typename Po
intInT,
typename Po
intOutT>
void
173 if (this->getKSearch () != 0)
176 "[pcl::%s::computeFeature] Error! Search method set to k-neighborhood. Call setKSearch(0) and setRadiusSearch( radius ) to use this class.\n",
177 getClassName().c_str ());
180 tree_->setSortedResults (
true);
182 for (std::size_t i = 0; i < indices_->size (); ++i)
186 PointOutT& output_rf = output[i];
190 if (getLocalRF ((*indices_)[i], rf) == std::numeric_limits<float>::max ())
192 output.is_dense =
false;
195 for (
int d = 0; d < 3; ++d)
197 output_rf.x_axis[d] = rf.row (0)[d];
198 output_rf.y_axis[d] = rf.row (1)[d];
199 output_rf.z_axis[d] = rf.row (2)[d];