Determine distance of a point x to the surface of the mesh and corresponding surface normal and next point on the surface.
| 295 | // Determine distance of a point x to the surface of the mesh and corresponding surface normal and |
| 296 | // next point on the surface. |
| 297 | double SamplingBase::distance(const Vector3r& x, const Real tolerance, Vector3r& normal, Vector3r& nextSurfacePoint) |
| 298 | { |
| 299 | Eigen::Vector3d n; |
| 300 | const double dist = m_distanceField->interpolate(0, x.template cast<double>(), &n); |
| 301 | if (dist == std::numeric_limits<double>::max()) |
| 302 | return dist; |
| 303 | n.normalize(); |
| 304 | normal = n.template cast<Real>(); |
| 305 | |
| 306 | nextSurfacePoint = (x - dist * normal); |
| 307 | |
| 308 | return dist - tolerance; |
| 309 | } |
| 310 | |
| 311 | // Determine distance of a point x to the surface of the mesh |
| 312 | double SamplingBase::distance(const Vector3r& x, const Real tolerance) |